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 (_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> <value>Launch layout editor</value>
<comment>launches the FancyZones layout editor application</comment> <comment>launches the FancyZones layout editor application</comment>
</data> </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"> <data name="FancyZones_LaunchEditorButtonControl.Description" xml:space="preserve">
<value>Set and manage your layouts</value> <value>Set and manage your layouts</value>
<comment>launches the FancyZones layout editor application</comment> <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> <value>Color Picker with editor mode enabled</value>
<comment>do not loc the product name</comment> <comment>do not loc the product name</comment>
</data> </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"> <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> <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> <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"> <data name="EditorFirst.Text" xml:space="preserve">
<value>Editor</value> <value>Editor</value>
</data> </data>
<data name="EditorFirst_Accesible.AutomationProperties.Name" xml:space="preserve">
<value>Editor</value>
</data>
<data name="ColorPicker_ActivationAction.Header" xml:space="preserve"> <data name="ColorPicker_ActivationAction.Header" xml:space="preserve">
<value>Activation behavior</value> <value>Activation behavior</value>
</data> </data>
@@ -989,6 +1000,10 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<value>Color Picker only</value> <value>Color Picker only</value>
<comment>do not loc the product name</comment> <comment>do not loc the product name</comment>
</data> </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"> <data name="ColorPickerOnly_Description.Text" xml:space="preserve">
<value>Pick a color from the screen and copy formatted value to clipboard</value> <value>Pick a color from the screen and copy formatted value to clipboard</value>
</data> </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"> <data name="ExcludedApps.Header" xml:space="preserve">
<value>Excluded apps</value> <value>Excluded apps</value>
</data> </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> </root>

View File

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

View File

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