整理代码

This commit is contained in:
GG Z
2026-02-20 15:31:44 +08:00
parent 94cf3f3266
commit 9f121cfc7f
149 changed files with 4063 additions and 6964 deletions

View File

@@ -1,10 +1,10 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:assists="clr-namespace:Melskin.Assists"
xmlns:controls="clr-namespace:Melskin.Controls"
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations"
xmlns:markup="clr-namespace:Melskin.Markup"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:markup="clr-namespace:Melskin.Markup">
<!-- 菜单栏样式 -->
<Style TargetType="{x:Type Menu}">
@@ -15,10 +15,10 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type Menu}">
<Border
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
@@ -32,28 +32,28 @@
<MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter" />
<Style
x:Key="MenuScrollButtonStyle"
BasedOn="{x:Null}"
TargetType="{x:Type RepeatButton}"
x:Key="MenuScrollButtonStyle">
TargetType="{x:Type RepeatButton}">
<Setter Property="ClickMode" Value="Hover" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Border
x:Name="templateRoot"
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="1"
SnapsToDevicePixels="true"
x:Name="templateRoot">
SnapsToDevicePixels="true">
<!--<ContentPresenter
Margin="6"
HorizontalAlignment="Center"
VerticalAlignment="Center" />-->
<ContentPresenter
Content="{Binding Path=(assists:ControlAssist.Icon), RelativeSource={RelativeSource TemplatedParent}}"
x:Name="Icon"
Margin="6"
TextElement.Foreground="{DynamicResource TextSecondaryBrush}"
x:Name="Icon" />
Content="{Binding Path=(assists:ControlAssist.Icon), RelativeSource={RelativeSource TemplatedParent}}"
TextElement.Foreground="{DynamicResource TextSecondaryBrush}" />
</Border>
</ControlTemplate>
</Setter.Value>
@@ -61,10 +61,10 @@
</Style>
<Style
BasedOn="{x:Null}"
TargetType="{x:Type ScrollViewer}"
x:Key="{ComponentResourceKey ResourceId=MenuScrollViewer,
TypeInTargetAssembly={x:Type FrameworkElement}}">
TypeInTargetAssembly={x:Type FrameworkElement}}"
BasedOn="{x:Null}"
TargetType="{x:Type ScrollViewer}">
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="Template">
@@ -79,17 +79,17 @@
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.Column="0" Grid.Row="1">
<ScrollContentPresenter CanContentScroll="{TemplateBinding CanContentScroll}" Margin="{TemplateBinding Padding}" />
<Border Grid.Row="1" Grid.Column="0">
<ScrollContentPresenter Margin="{TemplateBinding Padding}" CanContentScroll="{TemplateBinding CanContentScroll}" />
</Border>
<RepeatButton
Grid.Row="0"
Grid.Column="0"
assists:ControlAssist.Icon="{markup:Icon SymbolValue=ArrowDropUp}"
Command="{x:Static ScrollBar.LineUpCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Focusable="false"
Grid.Column="0"
Grid.Row="0"
Style="{StaticResource MenuScrollButtonStyle}"
assists:ControlAssist.Icon="{markup:Icon SymbolValue=ArrowDropUp}">
Style="{StaticResource MenuScrollButtonStyle}">
<RepeatButton.Visibility>
<MultiBinding
Converter="{StaticResource MenuScrollingVisibilityConverter}"
@@ -103,13 +103,13 @@
</RepeatButton.Visibility>
</RepeatButton>
<RepeatButton
Grid.Row="2"
Grid.Column="0"
assists:ControlAssist.Icon="{markup:Icon SymbolValue=ArrowDropDown}"
Command="{x:Static ScrollBar.LineDownCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Focusable="false"
Grid.Column="0"
Grid.Row="2"
Style="{StaticResource MenuScrollButtonStyle}"
assists:ControlAssist.Icon="{markup:Icon SymbolValue=ArrowDropDown}">
Style="{StaticResource MenuScrollButtonStyle}">
<RepeatButton.Visibility>
<MultiBinding
Converter="{StaticResource MenuScrollingVisibilityConverter}"
@@ -129,60 +129,60 @@
</Style>
<!-- 顶层菜单 -->
<ControlTemplate TargetType="{x:Type MenuItem}" x:Key="{ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}">
<ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
<Border
x:Name="templateRoot"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
SnapsToDevicePixels="true"
x:Name="templateRoot">
SnapsToDevicePixels="true">
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter
ContentSource="Icon"
Height="16"
HorizontalAlignment="Center"
Margin="3"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="Center"
x:Name="Icon"
Width="16"
x:Name="Icon" />
Height="16"
Margin="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ContentSource="Icon"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<controls:IconElement
FlowDirection="LeftToRight"
Foreground="{DynamicResource PrimaryGradientBrush}"
x:Name="GlyphPanel"
Grid.Column="0"
Margin="2"
Symbol="Check"
VerticalAlignment="Center"
Visibility="Collapsed"
x:Name="GlyphPanel" />
FlowDirection="LeftToRight"
Foreground="{DynamicResource PrimaryGradientBrush}"
Symbol="Check"
Visibility="Collapsed" />
<ContentPresenter
ContentSource="Header"
Grid.Column="1"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center"
ContentSource="Header"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="Center" />
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible" />
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
<Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
<Setter TargetName="templateRoot" Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{DynamicResource TextDisabledBrush}" />
<Setter Property="Foreground" TargetName="GlyphPanel" Value="{DynamicResource PrimaryDisabledBrush}" />
<Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
<Setter TargetName="GlyphPanel" Property="Foreground" Value="{DynamicResource PrimaryDisabledBrush}" />
</Trigger>
<!-- TODO:调整此处样式 -->
<MultiTrigger>
@@ -190,85 +190,85 @@
<Condition Property="IsHighlighted" Value="True" />
<Condition Property="IsEnabled" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{DynamicResource BorderNormalBrush}" />
<Setter TargetName="templateRoot" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter TargetName="templateRoot" Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- 顶层带子项的菜单 -->
<ControlTemplate TargetType="{x:Type MenuItem}" x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}">
<ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
<Border
x:Name="templateRoot"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
SnapsToDevicePixels="true"
x:Name="templateRoot">
SnapsToDevicePixels="true">
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter
ContentSource="Icon"
Height="16"
HorizontalAlignment="Center"
Margin="3"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="Center"
x:Name="Icon"
Width="16"
x:Name="Icon" />
Height="16"
Margin="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ContentSource="Icon"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<controls:IconElement
FlowDirection="LeftToRight"
Foreground="{DynamicResource PrimaryGradientBrush}"
x:Name="GlyphPanel"
Grid.Column="0"
Margin="3"
Symbol="Check"
VerticalAlignment="Center"
Visibility="Collapsed"
x:Name="GlyphPanel" />
FlowDirection="LeftToRight"
Foreground="{DynamicResource PrimaryGradientBrush}"
Symbol="Check"
Visibility="Collapsed" />
<ContentPresenter
ContentSource="Header"
Grid.Column="1"
Margin="{TemplateBinding Padding}"
ContentSource="Header"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<!-- 打开子菜单面板 -->
<Popup
x:Name="PART_Popup"
Grid.Column="0"
AllowsTransparency="true"
Focusable="false"
Grid.Column="0"
IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
Placement="Bottom"
PlacementTarget="{Binding ElementName=templateRoot}"
PopupAnimation="Fade"
x:Name="PART_Popup">
PopupAnimation="Fade">
<decorations:LightedSurface
Margin="8"
Padding="0"
BorderBrush="{DynamicResource BorderGradientBrush}"
BorderThickness="1"
Effect="{DynamicResource PopupShadow}"
Margin="8"
Padding="0">
<Border Margin="2,1" x:Name="SubMenuBorder">
<ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" x:Name="SubMenuScrollViewer">
Effect="{DynamicResource PopupShadow}">
<Border x:Name="SubMenuBorder" Margin="2,1">
<ScrollViewer x:Name="SubMenuScrollViewer" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
<Grid RenderOptions.ClearTypeHint="Enabled">
<Canvas
Width="0"
Height="0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="0">
VerticalAlignment="Top">
<Rectangle
Fill="{Binding Background, ElementName=SubMenuBorder}"
Height="{Binding ActualHeight, ElementName=SubMenuBorder}"
x:Name="OpaqueRect"
Width="{Binding ActualWidth, ElementName=SubMenuBorder}"
x:Name="OpaqueRect" />
Height="{Binding ActualHeight, ElementName=SubMenuBorder}"
Fill="{Binding Background, ElementName=SubMenuBorder}" />
</Canvas>
<ItemsPresenter
x:Name="ItemsPresenter"
Grid.IsSharedSizeScope="true"
KeyboardNavigation.DirectionalNavigation="Cycle"
KeyboardNavigation.TabNavigation="Cycle"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
x:Name="ItemsPresenter" />
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
</ScrollViewer>
</Border>
@@ -278,112 +278,112 @@
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
<Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None" />
<Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None" />
</Trigger>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible" />
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
<Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource BackgroundFloatingBrush}" />
<Setter TargetName="templateRoot" Property="Background" Value="{DynamicResource BackgroundFloatingBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{DynamicResource TextDisabledBrush}" />
<Setter Property="Foreground" TargetName="GlyphPanel" Value="{DynamicResource PrimaryDisabledBrush}" />
<Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
<Setter TargetName="GlyphPanel" Property="Foreground" Value="{DynamicResource PrimaryDisabledBrush}" />
</Trigger>
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="SubMenuScrollViewer" Value="false">
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}" />
<Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=SubMenuScrollViewer}" />
<Trigger SourceName="SubMenuScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
<Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}" />
<Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=SubMenuScrollViewer}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- 弹出菜单 -->
<ControlTemplate TargetType="{x:Type MenuItem}" x:Key="{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}">
<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
<Border
x:Name="templateRoot"
Height="28"
Margin="0,1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
Height="28"
Margin="0,1"
SnapsToDevicePixels="true"
x:Name="templateRoot">
SnapsToDevicePixels="true">
<Grid Margin="-1">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="Auto"
MinWidth="22"
SharedSizeGroup="MenuItemIconColumnGroup"
Width="Auto" />
SharedSizeGroup="MenuItemIconColumnGroup" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
<ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto" />
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup" />
<ColumnDefinition Width="12" />
</Grid.ColumnDefinitions>
<ContentPresenter
ContentSource="Icon"
Height="16"
HorizontalAlignment="Center"
Margin="3"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="Center"
x:Name="Icon"
Width="16"
x:Name="Icon" />
Height="16"
Margin="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ContentSource="Icon"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Border
x:Name="GlyphPanel"
Grid.Column="0"
Width="22"
Height="22"
Margin="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource ControlBackgroundSelectedBrush}"
ClipToBounds="False"
CornerRadius="4"
Grid.Column="0"
Height="22"
HorizontalAlignment="Center"
Margin="3"
VerticalAlignment="Center"
Visibility="Hidden"
Width="22"
x:Name="GlyphPanel">
Visibility="Hidden">
<controls:IconElement
x:Name="Glyph"
Margin="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FlowDirection="LeftToRight"
Foreground="{DynamicResource PrimaryGradientBrush}"
HorizontalAlignment="Center"
Margin="4"
Symbol="Check"
VerticalAlignment="Center"
x:Name="Glyph" />
Symbol="Check" />
</Border>
<ContentPresenter
ContentSource="Header"
x:Name="menuHeaderContainer"
Grid.Column="1"
HorizontalAlignment="Left"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
x:Name="menuHeaderContainer" />
ContentSource="Header"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<TextBlock
x:Name="menuGestureText"
Grid.Column="3"
Margin="{TemplateBinding Padding}"
Opacity="0.7"
Text="{TemplateBinding InputGestureText}"
VerticalAlignment="Center"
x:Name="menuGestureText" />
Opacity="0.7"
Text="{TemplateBinding InputGestureText}" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible" />
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
<Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource BackgroundFloatingBrush}" />
<Setter TargetName="templateRoot" Property="Background" Value="{DynamicResource BackgroundFloatingBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{DynamicResource TextDisabledBrush}" />
<Setter Property="Foreground" TargetName="Glyph" Value="{DynamicResource PrimaryDisabledBrush}" />
<Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
<Setter TargetName="Glyph" Property="Foreground" Value="{DynamicResource PrimaryDisabledBrush}" />
</Trigger>
<!-- TODO:更改样式 -->
<MultiTrigger>
@@ -391,117 +391,117 @@
<Condition Property="IsHighlighted" Value="True" />
<Condition Property="IsEnabled" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{DynamicResource BorderNormalBrush}" />
<Setter TargetName="templateRoot" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter TargetName="templateRoot" Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- 弹出带子项菜单 -->
<ControlTemplate TargetType="{x:Type MenuItem}" x:Key="{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}">
<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
<Border
x:Name="templateRoot"
Height="28"
Margin="0,1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
Height="28"
Margin="0,1"
SnapsToDevicePixels="true"
x:Name="templateRoot">
SnapsToDevicePixels="true">
<Grid Margin="-1">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="Auto"
MinWidth="22"
SharedSizeGroup="MenuItemIconColumnGroup"
Width="Auto" />
SharedSizeGroup="MenuItemIconColumnGroup" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
<ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto" />
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup" />
<ColumnDefinition Width="12" />
</Grid.ColumnDefinitions>
<ContentPresenter
ContentSource="Icon"
Height="16"
HorizontalAlignment="Center"
Margin="3"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="Center"
x:Name="Icon"
Width="16"
x:Name="Icon" />
Height="16"
Margin="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ContentSource="Icon"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Border
x:Name="GlyphPanel"
Grid.Column="0"
Width="22"
Height="22"
Margin="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource ControlBackgroundSelectedBrush}"
CornerRadius="4"
Grid.Column="0"
Height="22"
HorizontalAlignment="Center"
Margin="3"
VerticalAlignment="Center"
Visibility="Hidden"
Width="22"
x:Name="GlyphPanel">
Visibility="Hidden">
<controls:IconElement
x:Name="Glyph"
Margin="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FlowDirection="LeftToRight"
Foreground="{DynamicResource PrimaryGradientBrush}"
HorizontalAlignment="Center"
Margin="4"
Symbol="Check"
VerticalAlignment="Center"
x:Name="Glyph" />
Symbol="Check" />
</Border>
<ContentPresenter
ContentSource="Header"
Grid.Column="1"
HorizontalAlignment="Left"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
ContentSource="Header"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="Center" />
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<TextBlock
Grid.Column="3"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center"
Opacity="0.7"
Text="{TemplateBinding InputGestureText}"
VerticalAlignment="Center" />
Text="{TemplateBinding InputGestureText}" />
<controls:IconElement
Foreground="{DynamicResource TextPrimaryBrush}"
x:Name="ArrowRight"
Grid.Column="4"
Symbol="KeyboardArrowRight"
x:Name="ArrowRight" />
Foreground="{DynamicResource TextPrimaryBrush}"
Symbol="KeyboardArrowRight" />
<Popup
x:Name="PART_Popup"
Grid.Column="0"
AllowsTransparency="true"
Focusable="false"
Grid.Column="0"
HorizontalOffset="-2"
IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
Placement="Right"
PopupAnimation="Fade"
VerticalOffset="-3"
x:Name="PART_Popup">
VerticalOffset="-3">
<decorations:LightedSurface
Margin="8"
Padding="0"
BorderBrush="{DynamicResource BorderGradientBrush}"
BorderThickness="1"
Effect="{DynamicResource PopupShadow}"
Margin="8"
Padding="0">
<Border Margin="2,1" x:Name="SubMenuBorder">
<ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" x:Name="SubMenuScrollViewer">
Effect="{DynamicResource PopupShadow}">
<Border x:Name="SubMenuBorder" Margin="2,1">
<ScrollViewer x:Name="SubMenuScrollViewer" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
<Grid RenderOptions.ClearTypeHint="Enabled">
<Canvas
Width="0"
Height="0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="0">
VerticalAlignment="Top">
<Rectangle
Fill="{Binding Background, ElementName=SubMenuBorder}"
Height="{Binding ActualHeight, ElementName=SubMenuBorder}"
x:Name="OpaqueRect"
Width="{Binding ActualWidth, ElementName=SubMenuBorder}"
x:Name="OpaqueRect" />
Height="{Binding ActualHeight, ElementName=SubMenuBorder}"
Fill="{Binding Background, ElementName=SubMenuBorder}" />
</Canvas>
<ItemsPresenter
x:Name="ItemsPresenter"
Grid.IsSharedSizeScope="true"
KeyboardNavigation.DirectionalNavigation="Cycle"
KeyboardNavigation.TabNavigation="Cycle"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
x:Name="ItemsPresenter" />
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
</ScrollViewer>
</Border>
@@ -511,26 +511,26 @@
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
<Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None" />
<Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None" />
</Trigger>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible" />
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
<Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource BackgroundFloatingBrush}" />
<Setter TargetName="templateRoot" Property="Background" Value="{DynamicResource BackgroundFloatingBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{DynamicResource TextDisabledBrush}" />
<Setter Property="Foreground" TargetName="Glyph" Value="{DynamicResource PrimaryDisabledBrush}" />
<Setter Property="Foreground" TargetName="ArrowRight" Value="{DynamicResource TextDisabledBrush}" />
<Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
<Setter TargetName="Glyph" Property="Foreground" Value="{DynamicResource PrimaryDisabledBrush}" />
<Setter TargetName="ArrowRight" Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
</Trigger>
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="SubMenuScrollViewer" Value="false">
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}" />
<Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=SubMenuScrollViewer}" />
<Trigger SourceName="SubMenuScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
<Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}" />
<Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=SubMenuScrollViewer}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -584,17 +584,17 @@
<ControlTemplate TargetType="{x:Type ContextMenu}">
<Grid>
<Border
x:Name="Border"
Margin="8"
Padding="0"
Background="{TemplateBinding Background}"
BorderThickness="0"
CornerRadius="4"
Effect="{DynamicResource PopupShadow}"
Margin="8"
Padding="0"
x:Name="Border">
Effect="{DynamicResource PopupShadow}">
<StackPanel
Margin="2,1"
IsItemsHost="True"
KeyboardNavigation.DirectionalNavigation="Cycle"
Margin="2,1" />
KeyboardNavigation.DirectionalNavigation="Cycle" />
</Border>
<Rectangle
Margin="8"