Setting automation properties

This commit is contained in:
Niels Laute
2021-08-12 00:06:01 +02:00
parent 88c5c07dd3
commit 0c36e3fb7d
4 changed files with 63 additions and 28 deletions

View File

@@ -123,9 +123,13 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
if (_setting.ActionContent != null)
{
if (!string.IsNullOrEmpty(_setting.Header))
if (_setting.ActionContent.GetType() != typeof(Button))
{
AutomationProperties.SetName((UIElement)_setting.ActionContent, _setting.Header);
// We do not want to override the default AutomationProperties.Name of a button. It's content already describes what it does.
if (!string.IsNullOrEmpty(_setting.Header))
{
AutomationProperties.SetName((UIElement)_setting.ActionContent, _setting.Header);
}
}
}

View File

@@ -432,6 +432,10 @@ Disabling this module or closing PowerToys will unmute the microphone and camera
<value>Launch layout editor</value>
<comment>launches the FancyZones layout editor application</comment>
</data>
<data name="FancyZones_LaunchEditorButton_Accesible.AutomationProperties.Name" xml:space="preserve">
<value>Launch layout editor</value>
<comment>launches the FancyZones layout editor application</comment>
</data>
<data name="FancyZones_LaunchEditorButtonControl.Description" xml:space="preserve">
<value>Set and manage your layouts</value>
<comment>launches the FancyZones layout editor application</comment>
@@ -937,6 +941,10 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<value>Color Picker with editor mode enabled</value>
<comment>do not loc the product name</comment>
</data>
<data name="ColorPickerFirst_Accesible.AutomationProperties.Name" xml:space="preserve">
<value>Color Picker with editor mode enabled</value>
<comment>do not loc the product name</comment>
</data>
<data name="ColorPickerFirst_Description.Text" xml:space="preserve">
<value>Pick a color from the screen, copy formatted value to clipboard, then to the editor</value>
<comment>do not loc the product name</comment>
@@ -944,6 +952,9 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<data name="EditorFirst.Text" xml:space="preserve">
<value>Editor</value>
</data>
<data name="EditorFirst_Accesible.AutomationProperties.Name" xml:space="preserve">
<value>Editor</value>
</data>
<data name="ColorPicker_ActivationAction.Header" xml:space="preserve">
<value>Activation behavior</value>
</data>
@@ -989,6 +1000,10 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<value>Color Picker only</value>
<comment>do not loc the product name</comment>
</data>
<data name="ColorPickerOnly_Accesible.AutomationProperties.Name" xml:space="preserve">
<value>Color Picker only</value>
<comment>do not loc the product name</comment>
</data>
<data name="ColorPickerOnly_Description.Text" xml:space="preserve">
<value>Pick a color from the screen and copy formatted value to clipboard</value>
</data>
@@ -1438,4 +1453,13 @@ From there, simply click on a Markdown file or SVG icon in the File Explorer and
<data name="ExcludedApps.Header" xml:space="preserve">
<value>Excluded apps</value>
</data>
<data name="Enable_ColorFormat.AutomationProperties.Name" xml:space="preserve">
<value>Enable colorformat</value>
</data>
<data name="More_Options_Button.AutomationProperties.Name" xml:space="preserve">
<value>More options</value>
</data>
<data name="More_Options_ButtonTooltip.Text" xml:space="preserve">
<value>More options</value>
</data>
</root>

View File

@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:models="using:Microsoft.PowerToys.Settings.UI.Library"
mc:Ignorable="d"
AutomationProperties.LandmarkType="Main">
@@ -49,7 +49,7 @@
</controls:SettingExpander.Header>
<controls:SettingExpander.Content>
<StackPanel Padding="56,16,16,24" Spacing="12">
<RadioButton IsChecked="{Binding ActivationOpensColorPickerAndEditor, Mode=TwoWay}" GroupName="ColorPickerActivationAction">
<RadioButton x:Uid="ColorPickerFirst_Accesible" IsChecked="{Binding ActivationOpensColorPickerAndEditor, Mode=TwoWay}" GroupName="ColorPickerActivationAction">
<RadioButton.Content>
<StackPanel>
<TextBlock x:Uid="ColorPickerFirst"/>
@@ -58,7 +58,7 @@
</RadioButton.Content>
</RadioButton>
<RadioButton IsChecked="{Binding ActivationOpensEditor, Mode=TwoWay}" GroupName="ColorPickerActivationAction">
<RadioButton x:Uid="EditorFirst_Accesible" IsChecked="{Binding ActivationOpensEditor, Mode=TwoWay}" GroupName="ColorPickerActivationAction">
<RadioButton.Content>
<StackPanel>
<TextBlock x:Uid="EditorFirst"/>
@@ -67,7 +67,7 @@
</RadioButton.Content>
</RadioButton>
<RadioButton IsChecked="{Binding ActivationOpensColorPickerOnly, Mode=TwoWay}" GroupName="ColorPickerActivationAction">
<RadioButton x:Uid="ColorPickerOnly_Accesible" IsChecked="{Binding ActivationOpensColorPickerOnly, Mode=TwoWay}" GroupName="ColorPickerActivationAction">
<RadioButton.Content>
<StackPanel>
<TextBlock x:Uid="ColorPickerOnly"/>
@@ -115,23 +115,24 @@
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="ColorPicker_Editor" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<controls:Setting x:Uid="ColorPicker_ColorFormats" Icon="&#xE14C;"/>
<controls:Setting x:Name="ColorFormatsSetting" x:Uid="ColorPicker_ColorFormats" Icon="&#xE14C;"/>
<!-- Disabled reordering by dragging -->
<!-- CanReorderItems="True" AllowDrop="True" -->
<ListView ItemsSource="{Binding ColorFormats, Mode=TwoWay}"
SelectionMode="None"
HorizontalAlignment="Stretch">
AutomationProperties.Name="{Binding ElementName=ColorFormatsSetting, Path=Header}"
SelectionMode="None"
HorizontalAlignment="Stretch">
<ListView.ItemTemplate>
<DataTemplate>
<Grid
HorizontalAlignment="Stretch"
Background="{ThemeResource CardBackgroundBrush}"
BorderThickness="{ThemeResource CardBorderThickness}"
BorderBrush="{ThemeResource CardBorderBrush}"
CornerRadius="{ThemeResource ControlCornerRadius}"
Padding="0,0,16,0"
MinHeight="68">
<DataTemplate x:DataType="models:ColorFormatModel">
<Grid AutomationProperties.Name="{x:Bind Name}"
HorizontalAlignment="Stretch"
Background="{ThemeResource CardBackgroundBrush}"
BorderThickness="{ThemeResource CardBorderThickness}"
BorderBrush="{ThemeResource CardBorderBrush}"
CornerRadius="{ThemeResource ControlCornerRadius}"
Padding="0,0,16,0"
MinHeight="68">
<!-- Disabled reordering by dragging
<Interactivity:Interaction.Behaviors>
@@ -150,18 +151,20 @@
<TextBlock FontWeight="SemiBold"
FontSize="16"
Margin="56,8,0,0"
Text="{Binding Name}"/>
Text="{x:Bind Name}"/>
<TextBlock Style="{StaticResource SecondaryTextStyle}"
Text="{Binding Example}"
Text="{x:Bind Example}"
Grid.Row="1"
Margin="56,0,0,8"/>
<ToggleSwitch IsOn="{Binding IsShown, Mode=TwoWay}"
OnContent=""
OffContent=""
<ToggleSwitch IsOn="{x:Bind IsShown, Mode=TwoWay}"
OnContent=""
OffContent=""
FlowDirection="RightToLeft"
Grid.RowSpan="2"
HorizontalAlignment="Right"
Margin="0,0,56,0"/>
x:Uid="Enable_ColorFormat"
AutomationProperties.HelpText="{x:Bind Name}"
HorizontalAlignment="Right"
Margin="0,0,56,0"/>
<!-- Disabled reordering by dragging
<TextBlock Text="&#xE76F;"
@@ -179,17 +182,21 @@
HorizontalAlignment="Right"
VerticalAlignment="Center"
Grid.RowSpan="2"
x:Uid="More_Options_Button"
Content="&#xE10C;">
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem IsEnabled="{Binding CanMoveUp}" Icon="Up" x:Uid="MoveUp" Click="ReorderButtonUp_Click"/>
<MenuFlyoutItem IsEnabled="{Binding CanMoveDown}" x:Uid="MoveDown" Click="ReorderButtonDown_Click">
<MenuFlyoutItem IsEnabled="{x:Bind CanMoveUp}" Icon="Up" x:Uid="MoveUp" Click="ReorderButtonUp_Click"/>
<MenuFlyoutItem IsEnabled="{x:Bind CanMoveDown}" x:Uid="MoveDown" Click="ReorderButtonDown_Click">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE1FD;" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</Button.Flyout>
<ToolTipService.ToolTip>
<TextBlock x:Uid="More_Options_ButtonTooltip" />
</ToolTipService.ToolTip>
</Button>
</Grid>
</DataTemplate>

View File

@@ -31,7 +31,7 @@
<controls:SettingsGroup x:Uid="FancyZones_Editor_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<Button Style="{StaticResource SettingButtonStyle}" Command="{x:Bind ViewModel.LaunchEditorEventHandler}">
<Button Style="{StaticResource SettingButtonStyle}" x:Uid="FancyZones_LaunchEditorButton_Accesible" Command="{x:Bind ViewModel.LaunchEditorEventHandler}">
<controls:Setting x:Uid="FancyZones_LaunchEditorButtonControl" Style="{StaticResource ExpanderHeaderSettingStyle}" Icon="&#xF246;">
<!--<controls:Setting.Icon>
<PathIcon Data="M45,48H25.5V45H45V25.5H25.5v-3H45V3H25.5V0H48V48ZM22.5,48H3V45H22.5V3H3V0H25.5V48ZM0,48V0H3V48Z"/>