Skip to content

Commit f7e0cbf

Browse files
committed
ux: style for disabled menu item
1 parent ba1ab40 commit f7e0cbf

File tree

2 files changed

+133
-143
lines changed

2 files changed

+133
-143
lines changed

src/Resources/Locales/en_US.axaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,13 @@
200200
<x:String x:Key="Text.Diff.Submodule.New" xml:space="preserve">NEW</x:String>
201201
<x:String x:Key="Text.Diff.SyntaxHighlight" xml:space="preserve">Syntax Highlighting</x:String>
202202
<x:String x:Key="Text.Diff.ToggleWordWrap" xml:space="preserve">Line Word Wrap</x:String>
203-
<x:String x:Key="Text.Diff.UseMerger" xml:space="preserve">Open In Merge Tool</x:String>
203+
<x:String x:Key="Text.Diff.UseMerger" xml:space="preserve">Open in Merge Tool</x:String>
204204
<x:String x:Key="Text.Diff.VisualLines.Decr" xml:space="preserve">Decrease Number of Visible Lines</x:String>
205205
<x:String x:Key="Text.Diff.VisualLines.Incr" xml:space="preserve">Increase Number of Visible Lines</x:String>
206206
<x:String x:Key="Text.Diff.Welcome" xml:space="preserve">SELECT FILE TO VIEW CHANGES</x:String>
207207
<x:String x:Key="Text.Diff.ShowHiddenSymbols" xml:space="preserve">Show hidden symbols</x:String>
208208
<x:String x:Key="Text.Diff.SwapCommits" xml:space="preserve">Swap</x:String>
209-
<x:String x:Key="Text.DiffWithMerger" xml:space="preserve">Open In Merge Tool</x:String>
209+
<x:String x:Key="Text.DiffWithMerger" xml:space="preserve">Open in Merge Tool</x:String>
210210
<x:String x:Key="Text.Discard" xml:space="preserve">Discard Changes</x:String>
211211
<x:String x:Key="Text.Discard.All" xml:space="preserve">All local changes in working copy.</x:String>
212212
<x:String x:Key="Text.Discard.Changes" xml:space="preserve">Changes:</x:String>

src/Resources/Styles.axaml

Lines changed: 131 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@
251251
<Setter Property="HorizontalAlignment" Value="Left"/>
252252
<Setter Property="VerticalAlignment" Value="Center"/>
253253
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
254+
<Setter Property="FontFamily" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFont}"/>
254255
<Setter Property="FontSize" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize}"/>
255256
</Style>
256257
<Style Selector="TextBlock.small">
@@ -768,148 +769,137 @@
768769
</Style>
769770

770771
<Style Selector="MenuItem">
771-
<Style.Resources>
772-
<ControlTheme x:Key="{x:Type MenuItem}" TargetType="MenuItem">
773-
<Setter Property="Height" Value="28"/>
774-
<Setter Property="Background" Value="Transparent" />
775-
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}" />
776-
<Setter Property="Template">
777-
<ControlTemplate>
778-
<Panel>
779-
<Border Name="PART_LayoutRoot"
780-
Padding="0,0,4,0"
781-
Background="{TemplateBinding Background}"
782-
BorderBrush="{TemplateBinding BorderBrush}"
783-
BorderThickness="{TemplateBinding BorderThickness}"
784-
CornerRadius="3">
785-
<Grid>
786-
<Grid.ColumnDefinitions>
787-
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIcon" />
788-
<ColumnDefinition Width="*" />
789-
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGT" />
790-
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemChevron" />
791-
</Grid.ColumnDefinitions>
792-
793-
<Border Grid.Column="0" Width="28">
794-
<ContentControl x:Name="PART_IconPresenter"
795-
Content="{TemplateBinding Icon}"
796-
IsVisible="False"
797-
HorizontalAlignment="Center"
798-
VerticalAlignment="Center"/>
799-
</Border>
800-
801-
<ContentPresenter Grid.Column="1"
802-
Name="PART_HeaderPresenter"
803-
Content="{TemplateBinding Header}"
804-
ContentTemplate="{TemplateBinding HeaderTemplate}"
805-
VerticalAlignment="Center"
806-
HorizontalAlignment="Stretch"
807-
RecognizesAccessKey="False"/>
808-
<TextBlock x:Name="PART_InputGestureText"
809-
Grid.Column="2"
810-
Classes="CaptionTextBlockStyle"
811-
Margin="{DynamicResource MenuInputGestureTextMargin}"
812-
Text="{TemplateBinding InputGesture, Converter={StaticResource KeyGestureConverter}}"
813-
HorizontalAlignment="Right"
814-
VerticalAlignment="Center"
815-
Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"
816-
FontSize="11"/>
817-
<Path Name="PART_ChevronPath"
818-
Width="6"
819-
Data="M573 512 215 881c-20 20-20 51 0 61l61 61c20 20 51 20 61 0l461-461c10-10 10-20 10-31s0-20-10-31L338 20C317 0 287 0 276 20L215 82c-20 20-20 51 0 61L573 512z"
820-
Fill="{DynamicResource Brush.FG2}"
821-
Margin="8,0,0,0"
822-
VerticalAlignment="Center"
823-
Grid.Column="3" />
824-
</Grid>
772+
<Setter Property="Height" Value="28"/>
773+
<Setter Property="Background" Value="Transparent" />
774+
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}" />
775+
776+
<Setter Property="Template">
777+
<ControlTemplate>
778+
<Panel>
779+
<Border Name="PART_LayoutRoot"
780+
Padding="0,0,4,0"
781+
Background="{TemplateBinding Background}"
782+
BorderBrush="{TemplateBinding BorderBrush}"
783+
BorderThickness="{TemplateBinding BorderThickness}"
784+
CornerRadius="3">
785+
<Grid>
786+
<Grid.ColumnDefinitions>
787+
<ColumnDefinition Width="28" SharedSizeGroup="MenuItemIcon" />
788+
<ColumnDefinition Width="*" />
789+
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGT" />
790+
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemChevron" />
791+
</Grid.ColumnDefinitions>
792+
793+
<ContentControl Grid.Column="0"
794+
x:Name="PART_IconPresenter"
795+
Content="{TemplateBinding Icon}"
796+
IsVisible="False"
797+
HorizontalAlignment="Center"
798+
VerticalAlignment="Center"/>
799+
800+
<ContentPresenter Grid.Column="1"
801+
x:Name="PART_HeaderPresenter"
802+
Content="{TemplateBinding Header}"
803+
Foreground="{TemplateBinding Foreground}"
804+
ContentTemplate="{TemplateBinding HeaderTemplate}"
805+
VerticalAlignment="Center"
806+
HorizontalAlignment="Stretch"
807+
RecognizesAccessKey="False"/>
808+
809+
<TextBlock x:Name="PART_InputGestureText"
810+
Grid.Column="2"
811+
Classes="CaptionTextBlockStyle"
812+
Margin="{DynamicResource MenuInputGestureTextMargin}"
813+
Text="{TemplateBinding InputGesture, Converter={StaticResource KeyGestureConverter}}"
814+
HorizontalAlignment="Right"
815+
VerticalAlignment="Center"
816+
Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"
817+
FontSize="11"/>
818+
819+
<Path Name="PART_ChevronPath"
820+
Width="6"
821+
Data="M573 512 215 881c-20 20-20 51 0 61l61 61c20 20 51 20 61 0l461-461c10-10 10-20 10-31s0-20-10-31L338 20C317 0 287 0 276 20L215 82c-20 20-20 51 0 61L573 512z"
822+
Fill="{DynamicResource Brush.FG2}"
823+
Margin="8,0,0,0"
824+
VerticalAlignment="Center"
825+
Grid.Column="3" />
826+
</Grid>
827+
</Border>
828+
<Popup Name="PART_Popup"
829+
WindowManagerAddShadowHint="False"
830+
Placement="RightEdgeAlignedTop"
831+
MaxHeight="400"
832+
IsLightDismissEnabled="False"
833+
HorizontalOffset="-4"
834+
VerticalOffset="-4"
835+
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}">
836+
<Grid>
837+
<Border Background="{DynamicResource Brush.Popup}" Margin="4" CornerRadius="{DynamicResource OverlayCornerRadius}">
838+
<Border.Effect>
839+
<DropShadowEffect OffsetX="0" OffsetY="0" Color="Black" BlurRadius="4" Opacity=".6"/>
840+
</Border.Effect>
825841
</Border>
826-
<Popup Name="PART_Popup"
827-
WindowManagerAddShadowHint="False"
828-
Placement="RightEdgeAlignedTop"
829-
MaxHeight="400"
830-
IsLightDismissEnabled="False"
831-
HorizontalOffset="-4"
832-
VerticalOffset="-4"
833-
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}">
834-
<Grid>
835-
<Border Background="{DynamicResource Brush.Popup}" Margin="4" CornerRadius="{DynamicResource OverlayCornerRadius}">
836-
<Border.Effect>
837-
<DropShadowEffect OffsetX="0" OffsetY="0" Color="Black" BlurRadius="4" Opacity=".6"/>
838-
</Border.Effect>
839-
</Border>
840-
841-
<Border BorderThickness="0"
842-
Margin="8,4"
843-
MaxWidth="{DynamicResource FlyoutThemeMaxWidth}"
844-
MinHeight="{DynamicResource MenuFlyoutThemeMinHeight}"
845-
HorizontalAlignment="Stretch"
846-
CornerRadius="{DynamicResource OverlayCornerRadius}">
847-
<ScrollViewer Theme="{StaticResource FluentMenuScrollViewer}">
848-
<ItemsPresenter Name="PART_ItemsPresenter"
849-
Margin="{DynamicResource MenuFlyoutScrollerMargin}"
850-
Grid.IsSharedSizeScope="True">
851-
<ItemsPresenter.ItemsPanel>
852-
<ItemsPanelTemplate>
853-
<VirtualizingStackPanel Orientation="Vertical"/>
854-
</ItemsPanelTemplate>
855-
</ItemsPresenter.ItemsPanel>
856-
</ItemsPresenter>
857-
</ScrollViewer>
858-
</Border>
859-
</Grid>
860-
</Popup>
861-
</Panel>
862-
</ControlTemplate>
863-
</Setter>
864-
865-
<Style Selector="^:icon /template/ ContentControl#PART_IconPresenter">
866-
<Setter Property="IsVisible" Value="True" />
867-
</Style>
868-
869-
<Style Selector="^:selected">
870-
<Style Selector="^ /template/ Border#PART_LayoutRoot">
871-
<Setter Property="Background" Value="{DynamicResource MenuFlyoutItemBackgroundPointerOver}" />
872-
</Style>
873-
<Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter">
874-
<Setter Property="Foreground" Value="{DynamicResource MenuFlyoutItemForegroundPointerOver}" />
875-
</Style>
876-
<Style Selector="^ /template/ TextBlock#PART_InputGestureText">
877-
<Setter Property="Foreground" Value="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForegroundPointerOver}" />
878-
</Style>
879-
<Style Selector="^ /template/ Path#PART_ChevronPath">
880-
<Setter Property="Fill" Value="{DynamicResource MenuFlyoutSubItemChevronPointerOver}" />
881-
</Style>
882-
</Style>
883-
884-
<Style Selector="^:disabled">
885-
<Style Selector="^ /template/ Border#PART_LayoutRoot">
886-
<Setter Property="Background" Value="{DynamicResource MenuFlyoutItemBackgroundDisabled}" />
887-
</Style>
888-
<Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter">
889-
<Setter Property="Foreground" Value="{DynamicResource MenuFlyoutItemForegroundDisabled}" />
890-
</Style>
891-
<Style Selector="^ /template/ TextBlock#PART_InputGestureText">
892-
<Setter Property="Foreground" Value="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForegroundDisabled}" />
893-
</Style>
894-
<Style Selector="^ /template/ Path#PART_ChevronPath">
895-
<Setter Property="Fill" Value="{DynamicResource MenuFlyoutSubItemChevronDisabled}" />
896-
</Style>
897-
</Style>
898-
899-
<Style Selector="^:empty /template/ Path#PART_ChevronPath">
900-
<Setter Property="IsVisible" Value="False" />
901-
</Style>
902-
903-
<Style Selector="^:separator">
904-
<Setter Property="Height" Value="5"/>
905-
<Setter Property="Template">
906-
<ControlTemplate>
907-
<Separator Margin="28,0,4,0" Height=".5" VerticalAlignment="Center" Background="{DynamicResource Brush.Border2}"/>
908-
</ControlTemplate>
909-
</Setter>
910-
</Style>
911-
</ControlTheme>
912-
</Style.Resources>
842+
843+
<Border BorderThickness="0"
844+
Margin="8,4"
845+
MaxWidth="{DynamicResource FlyoutThemeMaxWidth}"
846+
MinHeight="{DynamicResource MenuFlyoutThemeMinHeight}"
847+
HorizontalAlignment="Stretch"
848+
CornerRadius="{DynamicResource OverlayCornerRadius}">
849+
<ScrollViewer Theme="{StaticResource FluentMenuScrollViewer}">
850+
<ItemsPresenter Name="PART_ItemsPresenter"
851+
Margin="{DynamicResource MenuFlyoutScrollerMargin}"
852+
Grid.IsSharedSizeScope="True">
853+
<ItemsPresenter.ItemsPanel>
854+
<ItemsPanelTemplate>
855+
<VirtualizingStackPanel Orientation="Vertical"/>
856+
</ItemsPanelTemplate>
857+
</ItemsPresenter.ItemsPanel>
858+
</ItemsPresenter>
859+
</ScrollViewer>
860+
</Border>
861+
</Grid>
862+
</Popup>
863+
</Panel>
864+
</ControlTemplate>
865+
</Setter>
866+
867+
<Style Selector="^:icon /template/ ContentControl#PART_IconPresenter">
868+
<Setter Property="IsVisible" Value="True" />
869+
</Style>
870+
871+
<Style Selector="^:selected">
872+
<Style Selector="^ /template/ Border#PART_LayoutRoot">
873+
<Setter Property="Background" Value="{DynamicResource MenuFlyoutItemBackgroundPointerOver}" />
874+
</Style>
875+
<Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter">
876+
<Setter Property="Foreground" Value="{DynamicResource MenuFlyoutItemForegroundPointerOver}" />
877+
</Style>
878+
<Style Selector="^ /template/ TextBlock#PART_InputGestureText">
879+
<Setter Property="Foreground" Value="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForegroundPointerOver}" />
880+
</Style>
881+
<Style Selector="^ /template/ Path#PART_ChevronPath">
882+
<Setter Property="Fill" Value="{DynamicResource MenuFlyoutSubItemChevronPointerOver}" />
883+
</Style>
884+
</Style>
885+
886+
<Style Selector="^:disabled">
887+
<Setter Property="Opacity" Value="0.65"/>
888+
<Setter Property="Background" Value="Transparent" />
889+
</Style>
890+
891+
<Style Selector="^:empty /template/ Path#PART_ChevronPath">
892+
<Setter Property="IsVisible" Value="False" />
893+
</Style>
894+
895+
<Style Selector="^:separator">
896+
<Setter Property="Height" Value="5"/>
897+
<Setter Property="Template">
898+
<ControlTemplate>
899+
<Separator Margin="28,0,4,0" Height=".5" VerticalAlignment="Center" Background="{DynamicResource Brush.Border2}"/>
900+
</ControlTemplate>
901+
</Setter>
902+
</Style>
913903
</Style>
914904

915905
<Style Selector="ComboBox">

0 commit comments

Comments
 (0)