Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add dark mode styling for nested menu items #1543

Merged
merged 3 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@
<Button.ContextMenu>
<ContextMenu FlowDirection="LeftToRight" Loaded="ContextMenu_Loaded" Unloaded="ContextMenu_Unloaded" Style="{StaticResource ctxMenuDefault}">
<MenuItem Header="{x:Static Properties:Resources.EventRecordControlScopeHeader}">
<customcontrols:ToggleMenuItem x:Name="mniRaw" IsCheckable="False" Click="mniRB_Click" Style="{StaticResource miBoldOnSelection}"
<customcontrols:ToggleMenuItem x:Name="mniRaw" IsCheckable="False" Click="mniRB_Click"
AutomationProperties.Name="{x:Static Properties:Resources.mniRawAutomationPropertiesName}">
<MenuItem.Header>
<RadioButton x:Name="radiobuttonScopeSelf" GroupName="groupScope" Content="{x:Static Properties:Resources.mniRawAutomationPropertiesName}" Focusable="False"/>
</MenuItem.Header>
</customcontrols:ToggleMenuItem>
<customcontrols:ToggleMenuItem x:Name="mniControl" IsCheckable="False" Click="mniRB_Click" Style="{StaticResource miBoldOnSelection}"
<customcontrols:ToggleMenuItem x:Name="mniControl" IsCheckable="False" Click="mniRB_Click"
AutomationProperties.Name="{x:Static Properties:Resources.radiobuttonScopeSubtreeContent}">
<MenuItem.Header>
<RadioButton x:Name="radiobuttonScopeSubtree" GroupName="groupScope" Content="{x:Static Properties:Resources.radiobuttonScopeSubtreeContent}" Focusable="False"/>
</MenuItem.Header>
</customcontrols:ToggleMenuItem>
<customcontrols:ToggleMenuItem x:Name="mniContent" IsCheckable="False" Click="mniRB_Click" Style="{StaticResource miBoldOnSelection}"
<customcontrols:ToggleMenuItem x:Name="mniContent" IsCheckable="False" Click="mniRB_Click"
AutomationProperties.Name="{x:Static Properties:Resources.mniContentAutomationPropertiesName}">
<MenuItem.Header>
<RadioButton x:Name="radiobuttonScopeDescendents" GroupName="groupScope" Content="{x:Static Properties:Resources.mniContentAutomationPropertiesName}" Focusable="False"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,19 @@
<Button.ContextMenu>
<ContextMenu FlowDirection="LeftToRight" x:Name="cmHierarchySettings" Style="{StaticResource ctxMenuDefault}">
<MenuItem Header="{x:Static Properties:Resources.HierarchyControl_Menu_TreeView}">
<cc:ToggleMenuItem x:Name="mniRaw" IsCheckable="False" Click="mniRaw_Click" Style="{StaticResource miBoldOnSelection}"
<cc:ToggleMenuItem x:Name="mniRaw" IsCheckable="False" Click="mniRaw_Click"
AutomationProperties.Name="{x:Static Properties:Resources.mniRawAutomationPropertiesName1}">
<MenuItem.Header>
<RadioButton x:Name="rbRaw" Content="{x:Static Properties:Resources.HierarchyControl_Raw}" Loaded="mniRaw_Loaded" Click="rbRaw_Click" Focusable="False" />
</MenuItem.Header>
</cc:ToggleMenuItem>
<cc:ToggleMenuItem x:Name="mniControl" IsCheckable="False" Click="mniControl_Click" Style="{StaticResource miBoldOnSelection}"
<cc:ToggleMenuItem x:Name="mniControl" IsCheckable="False" Click="mniControl_Click"
AutomationProperties.Name="{x:Static Properties:Resources.mniControlAutomationPropertiesName}">
<MenuItem.Header>
<RadioButton x:Name="rbControl" Content="{x:Static Properties:Resources.HierarchyControl_Control}" Loaded="mniControl_Loaded" Click="rbControl_Click" Focusable="False" />
</MenuItem.Header>
</cc:ToggleMenuItem>
<cc:ToggleMenuItem x:Name="mniContent" IsCheckable="False" Click="mniContent_Click" Style="{StaticResource miBoldOnSelection}"
<cc:ToggleMenuItem x:Name="mniContent" IsCheckable="False" Click="mniContent_Click"
AutomationProperties.Name="{x:Static Properties:Resources.mniContentAutomationPropertiesName1}">
<MenuItem.Header>
<RadioButton x:Name="rbContent" Content="{x:Static Properties:Resources.HierarchyControl_Content}" Loaded="mniContent_Loaded" Click="rbContent_Click" Focusable="False" />
Expand Down
99 changes: 94 additions & 5 deletions src/AccessibilityInsights.SharedUx/Resources/Styles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,6 @@
<Setter TargetName="fbIcn" Property="Foreground" Value="{DynamicResource ResourceKey=IconBrush}"/>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" Value="{DynamicResource ResourceKey=SelectedBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ResourceKey=SelectedTextBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5"/>
Expand All @@ -1277,10 +1275,101 @@
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="{x:Static MenuItem.SubmenuItemTemplateKey}" TargetType="{x:Type MenuItem}">
<Border x:Name="Border" BorderBrush="Gray" Padding="8,4" BorderThickness="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<CheckBox x:Name="CheckMark" Visibility="Hidden" Focusable="False" IsHitTestVisible="False" Style="{StaticResource CheckBoxContastingBorder}"/>
<ContentPresenter VerticalAlignment="Center" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" LayoutTransform="{TemplateBinding LayoutTransform}"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Foreground" Value="{DynamicResource ResourceKey=TSRowSelectedFGBrush}"/>
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ResourceKey=TSRowSelectedBGBrush}"/>
<Setter Property="TextBlock.LayoutTransform">
<Setter.Value>
<ScaleTransform ScaleX=".97"/>
</Setter.Value>
</Setter>
<Setter Property="FontWeight" Value="Bold"/>
</Trigger>
<Trigger Property="IsHighlighted" Value="False">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ResourceKey=PrimaryBGBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ResourceKey=PrimaryFGBrush}"/>
<Setter Property="FontWeight" Value="Regular"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="CheckMark" Property="IsChecked" Value="True" />
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="CheckMark" Property="IsChecked" Value="False" />
</Trigger>
<Trigger Property="IsCheckable" Value="True">
<Setter TargetName="CheckMark" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
<ControlTemplate.Resources>
<Style TargetType="{x:Type RadioButton}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuItem}}, Path=IsHighlighted}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource ResourceKey=TSRowSelectedFGBrush}" />
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuItem}}, Path=IsHighlighted}" Value="False">
<Setter Property="Foreground" Value="{DynamicResource ResourceKey=PrimaryFGBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ControlTemplate.Resources>
</ControlTemplate>
<ControlTemplate x:Key="{x:Static MenuItem.SubmenuHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
<Border x:Name="Border" BorderBrush="Gray" Padding="8,4" BorderThickness="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ContentPresenter VerticalAlignment="Center" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" LayoutTransform="{TemplateBinding LayoutTransform}"/>
<Path Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Data="M 0 0 L 0 7 L 4 3.5 Z" Fill="Gray"/>
<Popup x:Name="Popup" IsOpen="{TemplateBinding IsSubmenuOpen}" Focusable="False" Placement="Right" HorizontalOffset="9" VerticalOffset="-6">
<Border x:Name="SubmenuBorder" BorderBrush="Gray" BorderThickness="1">
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
</Border>
</Popup>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Foreground" Value="{DynamicResource ResourceKey=TSRowSelectedFGBrush}"/>
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ResourceKey=TSRowSelectedBGBrush}"/>
<Setter Property="TextBlock.LayoutTransform">
<Setter.Value>
<ScaleTransform ScaleX=".97"/>
</Setter.Value>
</Setter>
<Setter Property="FontWeight" Value="Bold"/>
</Trigger>
<Trigger Property="IsHighlighted" Value="False">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ResourceKey=PrimaryBGBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ResourceKey=PrimaryFGBrush}"/>
<Setter Property="FontWeight" Value="Regular"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="{x:Type ContextMenu}" x:Key="ctxMenuDefault">
<Style.Resources>
<Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}" BasedOn="{StaticResource miBoldOnSelection}"/>
</Style.Resources>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Background="{DynamicResource ResourceKey=SecondaryBGBrush}" BorderBrush="Gray" BorderThickness="1">
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Menu}" x:Key="menuDefault">
<Style.Resources>
Expand Down