Skip to content

Commit

Permalink
Replace RadioButton expanders with ComboBoxes (#12833)
Browse files Browse the repository at this point in the history
Replaces all the `RadioButton` expanders with `ComboBox`es, which can have the options inline, as opposed to in the expander content. For example, here's a single commit with the changes for a single one of these settings: 745c77d

### Checklist
* [x] Closes #12648
* [x] Actually closes #9566 as well (by just removing all radio buttons)
* [x] I work here
* [x] Tested manually
* [x] I'd love @carlos-zamora to have an a11y pass at this, just to see if it's egregious or not.

### Before, after:

![image](https://user-images.githubusercontent.com/18356694/161822068-939ff875-00ff-454a-8b58-cb843ba801f4.png)
  • Loading branch information
zadjii-msft authored Apr 6, 2022
1 parent 8aa38d3 commit 9e03800
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 95 deletions.
43 changes: 19 additions & 24 deletions src/cascadia/TerminalSettingsEditor/Appearances.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>

<DataTemplate x:Key="EnumRadioButtonTemplate"
x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate>

<DataTemplate x:Key="EnumComboBoxItemTemplate"
<DataTemplate x:Key="EnumComboBoxTemplate"
x:DataType="local:EnumEntry">
<TextBlock Text="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate>
Expand Down Expand Up @@ -118,7 +113,7 @@
<StackPanel>
<ComboBox x:Name="FontWeightComboBox"
x:Uid="Profile_FontWeightComboBox"
ItemTemplate="{StaticResource EnumComboBoxItemTemplate}"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind FontWeightList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentFontWeight, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
Expand Down Expand Up @@ -176,12 +171,12 @@
<local:SettingContainer x:Uid="Profile_CursorShape"
ClearSettingValue="{x:Bind Appearance.ClearCursorShape}"
HasSettingValue="{x:Bind Appearance.HasCursorShape, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.CursorShapeOverrideSource, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind CursorShapeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentCursorShape, Mode=TwoWay}" />
SettingOverrideSource="{x:Bind Appearance.CursorShapeOverrideSource, Mode=OneWay}">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind CursorShapeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentCursorShape, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<!-- Cursor Height -->
Expand Down Expand Up @@ -245,12 +240,12 @@
ClearSettingValue="{x:Bind Appearance.ClearBackgroundImageStretchMode}"
HasSettingValue="{x:Bind Appearance.HasBackgroundImageStretchMode, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.BackgroundImageStretchModeOverrideSource, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}"
Visibility="{x:Bind Appearance.BackgroundImageSettingsVisible, Mode=OneWay}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind BackgroundImageStretchModeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentBackgroundImageStretchMode, Mode=TwoWay}" />
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind BackgroundImageStretchModeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentBackgroundImageStretchMode, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<!-- Background Image Alignment -->
Expand Down Expand Up @@ -472,12 +467,12 @@
<local:SettingContainer x:Uid="Appearance_IntenseTextStyle"
ClearSettingValue="{x:Bind Appearance.ClearIntenseTextStyle}"
HasSettingValue="{x:Bind Appearance.HasIntenseTextStyle, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.IntenseTextStyleOverrideSource, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind IntenseTextStyleList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentIntenseTextStyle, Mode=TwoWay}" />
SettingOverrideSource="{x:Bind Appearance.IntenseTextStyleOverrideSource, Mode=OneWay}">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind IntenseTextStyleList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentIntenseTextStyle, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
</StackPanel>

Expand Down
28 changes: 14 additions & 14 deletions src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>

<DataTemplate x:Key="EnumRadioButtonTemplate"
<DataTemplate x:Key="EnumComboBoxTemplate"
x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
<TextBlock Text="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate>
</ResourceDictionary>
</Page.Resources>
Expand All @@ -40,12 +40,12 @@
</local:SettingContainer>

<!-- Theme -->
<local:SettingContainer x:Uid="Globals_Theme"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind ThemeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentTheme, Mode=TwoWay}" />
<local:SettingContainer x:Uid="Globals_Theme">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ThemeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentTheme, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<!-- Always show tabs -->
Expand Down Expand Up @@ -79,12 +79,12 @@
</local:SettingContainer>

<!-- Tab Width Mode -->
<local:SettingContainer x:Uid="Globals_TabWidthMode"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind TabWidthModeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentTabWidthMode, Mode=TwoWay}" />
<local:SettingContainer x:Uid="Globals_TabWidthMode">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind TabWidthModeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentTabWidthMode, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<!-- Disable Animations -->
Expand Down
28 changes: 14 additions & 14 deletions src/cascadia/TerminalSettingsEditor/Interaction.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>

<DataTemplate x:Key="EnumRadioButtonTemplate"
<DataTemplate x:Key="EnumComboBoxTemplate"
x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
<TextBlock Text="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate>
</ResourceDictionary>
</Page.Resources>
Expand All @@ -33,12 +33,12 @@
</local:SettingContainer>

<!-- Copy Format -->
<local:SettingContainer x:Uid="Globals_CopyFormat"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind CopyFormatList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentCopyFormat, Mode=TwoWay}" />
<local:SettingContainer x:Uid="Globals_CopyFormat">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind CopyFormatList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentCopyFormat, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<!-- Trim Block Selection -->
Expand Down Expand Up @@ -69,12 +69,12 @@
</local:SettingContainer>

<!-- Tab Switcher Mode -->
<local:SettingContainer x:Uid="Globals_TabSwitcherMode"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind TabSwitcherModeList}"
SelectedItem="{x:Bind CurrentTabSwitcherMode, Mode=TwoWay}" />
<local:SettingContainer x:Uid="Globals_TabSwitcherMode">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind TabSwitcherModeList}"
SelectedItem="{x:Bind CurrentTabSwitcherMode, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<!-- Focus Follow Mouse Mode -->
Expand Down
42 changes: 21 additions & 21 deletions src/cascadia/TerminalSettingsEditor/Launch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>

<DataTemplate x:Key="EnumRadioButtonTemplate"
<DataTemplate x:Key="EnumComboBoxTemplate"
x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
<TextBlock Text="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate>
<SettingsModel:IconPathConverter x:Key="IconSourceConverter" />
<Style x:Key="LaunchSizeNumberBoxStyle"
Expand Down Expand Up @@ -137,32 +137,32 @@
</local:SettingContainer>

<!-- First Window Behavior -->
<local:SettingContainer x:Uid="Globals_FirstWindowPreference"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind FirstWindowPreferenceList}"
SelectedItem="{x:Bind CurrentFirstWindowPreference, Mode=TwoWay}" />
<local:SettingContainer x:Uid="Globals_FirstWindowPreference">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind FirstWindowPreferenceList}"
SelectedItem="{x:Bind CurrentFirstWindowPreference, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>


<!-- Launch Mode -->
<local:SettingContainer x:Name="Globals_LaunchMode"
x:Uid="Globals_LaunchMode"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind LaunchModeList}"
SelectedItem="{x:Bind CurrentLaunchMode, Mode=TwoWay}" />
x:Uid="Globals_LaunchMode">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind LaunchModeList}"
SelectedItem="{x:Bind CurrentLaunchMode, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<!-- Launch Mode -->
<local:SettingContainer x:Uid="Globals_WindowingBehavior"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind WindowingBehaviorList}"
SelectedItem="{x:Bind CurrentWindowingBehavior, Mode=TwoWay}" />
<!-- Windowing Behavior -->
<local:SettingContainer x:Uid="Globals_WindowingBehavior">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind WindowingBehaviorList}"
SelectedItem="{x:Bind CurrentWindowingBehavior, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<local:SettingContainer x:Uid="Globals_LaunchSize"
Expand Down
28 changes: 14 additions & 14 deletions src/cascadia/TerminalSettingsEditor/Profiles_Advanced.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>

<DataTemplate x:Key="EnumRadioButtonTemplate"
<DataTemplate x:Key="EnumComboBoxTemplate"
x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
<TextBlock Text="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate>
</ResourceDictionary>
</Page.Resources>
Expand Down Expand Up @@ -51,12 +51,12 @@
<local:SettingContainer x:Uid="Profile_AntialiasingMode"
ClearSettingValue="{x:Bind Profile.ClearAntialiasingMode}"
HasSettingValue="{x:Bind Profile.HasAntialiasingMode, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.AntialiasingModeOverrideSource, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind Profile.AntiAliasingModeList, Mode=OneWay}"
SelectedItem="{x:Bind Profile.CurrentAntiAliasingMode, Mode=TwoWay}" />
SettingOverrideSource="{x:Bind Profile.AntialiasingModeOverrideSource, Mode=OneWay}">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind Profile.AntiAliasingModeList, Mode=OneWay}"
SelectedItem="{x:Bind Profile.CurrentAntiAliasingMode, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<!-- AltGr Aliasing -->
Expand Down Expand Up @@ -94,12 +94,12 @@
<local:SettingContainer x:Uid="Profile_CloseOnExit"
ClearSettingValue="{x:Bind Profile.ClearCloseOnExit}"
HasSettingValue="{x:Bind Profile.HasCloseOnExit, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.CloseOnExitOverrideSource, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind Profile.CloseOnExitModeList, Mode=OneWay}"
SelectedItem="{x:Bind Profile.CurrentCloseOnExitMode, Mode=TwoWay}" />
SettingOverrideSource="{x:Bind Profile.CloseOnExitOverrideSource, Mode=OneWay}">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind Profile.CloseOnExitModeList, Mode=OneWay}"
SelectedItem="{x:Bind Profile.CurrentCloseOnExitMode, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<!-- Bell Style -->
Expand Down
Loading

0 comments on commit 9e03800

Please sign in to comment.