879 lines
40 KiB
XML
879 lines
40 KiB
XML
<ResourceDictionary
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:controls="clr-namespace:WPFluent.Controls"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
|
|
<Style
|
|
BasedOn="{StaticResource {x:Type ScrollViewer}}"
|
|
TargetType="{x:Type ScrollViewer}"
|
|
x:Key="UiMenuItemScrollViewer">
|
|
<Setter Property="HorizontalScrollBarVisibility" Value="Disabled" />
|
|
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
|
|
</Style>
|
|
|
|
<!--
|
|
DEFAULT WPF MENU ITEM
|
|
-->
|
|
|
|
<Style TargetType="{x:Type Separator}" x:Key="{x:Static MenuItem.SeparatorStyleKey}">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ControlAltFillColorTertiaryBrush}" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="Margin" Value="0,1,0,1" />
|
|
<Setter Property="BorderThickness" Value="1,1,0,0" />
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type Separator}">
|
|
<Border
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
Margin="{TemplateBinding Margin}"
|
|
Width="{TemplateBinding Width}" />
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<!-- TopLevelHeader -->
|
|
<ControlTemplate TargetType="{x:Type MenuItem}" x:Key="{x:Static MenuItem.TopLevelHeaderTemplateKey}">
|
|
<Border
|
|
Background="Transparent"
|
|
CornerRadius="6"
|
|
Margin="4"
|
|
x:Name="Border">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<Grid Margin="10">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<ContentPresenter
|
|
Content="{TemplateBinding Icon}"
|
|
Grid.Column="0"
|
|
Margin="0,0,6,0"
|
|
VerticalAlignment="Center"
|
|
x:Name="Icon" />
|
|
<ContentPresenter
|
|
ContentSource="Header"
|
|
Grid.Column="1"
|
|
RecognizesAccessKey="True"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
VerticalAlignment="Center"
|
|
x:Name="HeaderPresenter" />
|
|
</Grid>
|
|
|
|
<Popup
|
|
AllowsTransparency="True"
|
|
Focusable="False"
|
|
Grid.Column="0"
|
|
Grid.Row="1"
|
|
HorizontalOffset="-12"
|
|
IsOpen="{TemplateBinding IsSubmenuOpen}"
|
|
Placement="Bottom"
|
|
PlacementTarget="{Binding ElementName=Border}"
|
|
PopupAnimation="None"
|
|
VerticalOffset="1"
|
|
x:Name="Popup">
|
|
<Grid>
|
|
<Border
|
|
Background="{DynamicResource AcrylicBackgroundFillColorDefaultBrush}"
|
|
BorderBrush="{DynamicResource SurfaceStrokeColorFlyoutBrush}"
|
|
BorderThickness="1"
|
|
CornerRadius="8"
|
|
Margin="12,0,12,18"
|
|
Padding="0,3,0,3"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="SubmenuBorder">
|
|
<Border.RenderTransform>
|
|
<TranslateTransform />
|
|
</Border.RenderTransform>
|
|
<controls:PassiveScrollViewer CanContentScroll="True" Style="{StaticResource UiMenuItemScrollViewer}">
|
|
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
|
|
</controls:PassiveScrollViewer>
|
|
<Border.Effect>
|
|
<DropShadowEffect
|
|
BlurRadius="20"
|
|
Direction="270"
|
|
Opacity="0.25"
|
|
ShadowDepth="6" />
|
|
</Border.Effect>
|
|
</Border>
|
|
</Grid>
|
|
</Popup>
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="Icon" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="Header" Value="{x:Null}">
|
|
<Setter Property="Margin" TargetName="Icon" Value="0" />
|
|
<Setter Property="Visibility" TargetName="HeaderPresenter" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="IsHighlighted" Value="True">
|
|
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorTertiaryBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorDisabled}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
<Trigger Property="IsSubmenuOpen" Value="True">
|
|
<Trigger.EnterActions>
|
|
<BeginStoryboard>
|
|
<Storyboard>
|
|
<DoubleAnimation
|
|
Duration="00:00:00.167"
|
|
From="-90"
|
|
Storyboard.TargetName="SubmenuBorder"
|
|
Storyboard.TargetProperty="(Border.RenderTransform).(TranslateTransform.Y)"
|
|
To="0">
|
|
<DoubleAnimation.EasingFunction>
|
|
<CircleEase EasingMode="EaseOut" />
|
|
</DoubleAnimation.EasingFunction>
|
|
</DoubleAnimation>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</Trigger.EnterActions>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<!-- TopLevelItem -->
|
|
<ControlTemplate TargetType="{x:Type MenuItem}" x:Key="{x:Static MenuItem.TopLevelItemTemplateKey}">
|
|
<Border
|
|
Background="Transparent"
|
|
CornerRadius="6"
|
|
Margin="4"
|
|
x:Name="Border">
|
|
<Grid Margin="10">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<ContentPresenter
|
|
Content="{TemplateBinding Icon}"
|
|
Grid.Column="0"
|
|
KeyboardNavigation.IsTabStop="False"
|
|
Margin="0,0,6,0"
|
|
VerticalAlignment="Center"
|
|
x:Name="Icon" />
|
|
<ContentPresenter
|
|
ContentSource="Header"
|
|
Grid.Column="1"
|
|
RecognizesAccessKey="True"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
VerticalAlignment="Center"
|
|
x:Name="HeaderPresenter" />
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsHighlighted" Value="True">
|
|
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorTertiaryBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="Icon" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="Header" Value="{x:Null}">
|
|
<Setter Property="Margin" TargetName="Icon" Value="0" />
|
|
<Setter Property="Visibility" TargetName="HeaderPresenter" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorDisabled}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<!-- SubmenuItem -->
|
|
<ControlTemplate TargetType="{x:Type MenuItem}" x:Key="{x:Static MenuItem.SubmenuItemTemplateKey}">
|
|
<Border
|
|
Background="Transparent"
|
|
CornerRadius="4"
|
|
Margin="4,1,4,1"
|
|
x:Name="Border">
|
|
<Grid Margin="8,6,8,6">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition SharedSizeGroup="Shortcut" Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Border
|
|
BorderThickness="1"
|
|
CornerRadius="4"
|
|
Grid.Column="0"
|
|
Height="20"
|
|
Margin="0,0,6,0"
|
|
VerticalAlignment="Center"
|
|
Visibility="Collapsed"
|
|
Width="20"
|
|
x:Name="CheckBoxIconBorder">
|
|
<TextBlock
|
|
FontFamily="{DynamicResource FluentSystemIcons}"
|
|
FontSize="16"
|
|
HorizontalAlignment="Center"
|
|
Text=""
|
|
TextAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
x:Name="CheckBoxIcon" />
|
|
</Border>
|
|
|
|
<ContentPresenter
|
|
Content="{TemplateBinding Icon}"
|
|
Grid.Column="1"
|
|
KeyboardNavigation.IsTabStop="False"
|
|
Margin="0,0,6,0"
|
|
VerticalAlignment="Center"
|
|
x:Name="Icon" />
|
|
|
|
<ContentPresenter
|
|
ContentSource="Header"
|
|
Grid.Column="2"
|
|
RecognizesAccessKey="True"
|
|
TextElement.Foreground="{TemplateBinding Foreground}" />
|
|
|
|
<TextBlock
|
|
DockPanel.Dock="Right"
|
|
FontSize="11"
|
|
Foreground="{DynamicResource TextFillColorDisabledBrush}"
|
|
Grid.Column="3"
|
|
Margin="25,0,0,0"
|
|
Text="{TemplateBinding InputGestureText}"
|
|
VerticalAlignment="Bottom"
|
|
x:Name="InputGestureText" />
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsHighlighted" Value="True">
|
|
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorTertiaryBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="Icon" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="IsCheckable" Value="True">
|
|
<Setter Property="Visibility" TargetName="CheckBoxIconBorder" Value="Visible" />
|
|
</Trigger>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter Property="Text" TargetName="CheckBoxIcon" Value="" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorDisabled}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
<Trigger Property="InputGestureText" Value="">
|
|
<Setter Property="Visibility" TargetName="InputGestureText" Value="Collapsed" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<!-- SubItem with Subitems -->
|
|
<ControlTemplate TargetType="{x:Type MenuItem}" x:Key="{x:Static MenuItem.SubmenuHeaderTemplateKey}">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<Border
|
|
BorderThickness="1"
|
|
CornerRadius="4"
|
|
Grid.Row="1"
|
|
Margin="4,1,4,1"
|
|
x:Name="Border">
|
|
<Grid Margin="8,6,8,6" x:Name="MenuItemContent">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<ContentPresenter
|
|
Content="{TemplateBinding Icon}"
|
|
Grid.Column="0"
|
|
KeyboardNavigation.IsTabStop="False"
|
|
Margin="0,0,6,0"
|
|
VerticalAlignment="Center"
|
|
x:Name="Icon" />
|
|
|
|
<ContentPresenter
|
|
ContentSource="Header"
|
|
Grid.Column="1"
|
|
RecognizesAccessKey="True"
|
|
x:Name="HeaderHost" />
|
|
|
|
<Grid Grid.Column="2">
|
|
<controls:SymbolIcon
|
|
FontSize="{TemplateBinding FontSize}"
|
|
Margin="0,3,0,0"
|
|
Symbol="ChevronRight20"
|
|
VerticalAlignment="Center"
|
|
x:Name="Chevron" />
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<Popup
|
|
AllowsTransparency="True"
|
|
Focusable="False"
|
|
Grid.Row="1"
|
|
IsOpen="{TemplateBinding IsSubmenuOpen}"
|
|
Placement="Right"
|
|
PlacementTarget="{Binding ElementName=MenuItemContent}"
|
|
PopupAnimation="None"
|
|
VerticalOffset="-20"
|
|
x:Name="Popup">
|
|
<Grid>
|
|
<Border
|
|
Background="{DynamicResource AcrylicBackgroundFillColorDefaultBrush}"
|
|
BorderBrush="{DynamicResource SurfaceStrokeColorFlyoutBrush}"
|
|
BorderThickness="1"
|
|
CornerRadius="8"
|
|
Margin="12,10,12,18"
|
|
Padding="0,3,0,3"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="SubmenuBorder">
|
|
<Border.RenderTransform>
|
|
<TranslateTransform />
|
|
</Border.RenderTransform>
|
|
<controls:PassiveScrollViewer CanContentScroll="True" Style="{StaticResource UiMenuItemScrollViewer}">
|
|
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
|
|
</controls:PassiveScrollViewer>
|
|
<Border.Effect>
|
|
<DropShadowEffect
|
|
BlurRadius="20"
|
|
Direction="270"
|
|
Opacity="0.5"
|
|
ShadowDepth="6" />
|
|
</Border.Effect>
|
|
</Border>
|
|
</Grid>
|
|
</Popup>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="Icon" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
|
|
<Setter Property="Margin" TargetName="Icon" Value="0" />
|
|
</Trigger>
|
|
<Trigger Property="IsHighlighted" Value="true">
|
|
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorTertiaryBrush}" />
|
|
</Trigger>
|
|
<!--<Trigger SourceName="Popup" Property="AllowsTransparency" Value="True">
|
|
<Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="4" />
|
|
<Setter TargetName="SubmenuBorder" Property="Padding" Value="0,3,0,3" />
|
|
</Trigger>-->
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Foreground">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorDisabled}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Foreground" TargetName="Chevron">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorDisabled}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
<Trigger Property="IsSubmenuOpen" Value="True">
|
|
<Trigger.EnterActions>
|
|
<BeginStoryboard>
|
|
<Storyboard>
|
|
<DoubleAnimation
|
|
Duration="00:00:00.167"
|
|
From="-90"
|
|
Storyboard.TargetName="SubmenuBorder"
|
|
Storyboard.TargetProperty="(Border.RenderTransform).(TranslateTransform.Y)"
|
|
To="0">
|
|
<DoubleAnimation.EasingFunction>
|
|
<CircleEase EasingMode="EaseOut" />
|
|
</DoubleAnimation.EasingFunction>
|
|
</DoubleAnimation>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</Trigger.EnterActions>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<Style TargetType="{x:Type MenuItem}" x:Key="UiMenuItem">
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
|
<Setter Property="KeyboardNavigation.IsTabStop" Value="True" />
|
|
<Setter Property="Focusable" Value="True" />
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
<Style.Triggers>
|
|
<Trigger Property="Role" Value="TopLevelHeader">
|
|
<Setter Property="Template" Value="{StaticResource {x:Static MenuItem.TopLevelHeaderTemplateKey}}" />
|
|
<Setter Property="Grid.IsSharedSizeScope" Value="True" />
|
|
</Trigger>
|
|
<Trigger Property="Role" Value="TopLevelItem">
|
|
<Setter Property="Template" Value="{StaticResource {x:Static MenuItem.TopLevelItemTemplateKey}}" />
|
|
</Trigger>
|
|
<Trigger Property="Role" Value="SubmenuHeader">
|
|
<Setter Property="Template" Value="{StaticResource {x:Static MenuItem.SubmenuHeaderTemplateKey}}" />
|
|
</Trigger>
|
|
<Trigger Property="Role" Value="SubmenuItem">
|
|
<Setter Property="Template" Value="{StaticResource {x:Static MenuItem.SubmenuItemTemplateKey}}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style
|
|
BasedOn="{StaticResource UiMenuItem}"
|
|
TargetType="{x:Type MenuItem}"
|
|
x:Key="{x:Type MenuItem}" />
|
|
|
|
<!--
|
|
WPF UI MENU ITEM
|
|
-->
|
|
|
|
<!-- TopLevelHeader -->
|
|
<ControlTemplate TargetType="{x:Type controls:MenuItem}" x:Key="WpfUiMenuItemTopLevelHeaderTemplateKey">
|
|
<Border
|
|
Background="Transparent"
|
|
CornerRadius="6"
|
|
Margin="4"
|
|
x:Name="Border">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<Grid Margin="10">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<ContentControl
|
|
Content="{TemplateBinding Icon}"
|
|
FontSize="{TemplateBinding FontSize}"
|
|
Grid.Column="0"
|
|
KeyboardNavigation.IsTabStop="False"
|
|
Margin="0,0,6,0"
|
|
VerticalAlignment="Center"
|
|
x:Name="IconElement" />
|
|
|
|
<ContentPresenter
|
|
ContentSource="Header"
|
|
Grid.Column="2"
|
|
RecognizesAccessKey="True"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
VerticalAlignment="Center"
|
|
x:Name="HeaderPresenter" />
|
|
</Grid>
|
|
|
|
<Popup
|
|
AllowsTransparency="True"
|
|
Focusable="False"
|
|
Grid.Column="0"
|
|
Grid.Row="1"
|
|
HorizontalOffset="-12"
|
|
IsOpen="{TemplateBinding IsSubmenuOpen}"
|
|
Placement="Bottom"
|
|
PlacementTarget="{Binding ElementName=Border}"
|
|
PopupAnimation="None"
|
|
VerticalOffset="1"
|
|
x:Name="Popup">
|
|
<Grid>
|
|
<Border
|
|
Background="{DynamicResource AcrylicBackgroundFillColorDefaultBrush}"
|
|
BorderBrush="{DynamicResource SurfaceStrokeColorFlyoutBrush}"
|
|
BorderThickness="1"
|
|
CornerRadius="8"
|
|
Margin="12,0,12,18"
|
|
Padding="0,3,0,3"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="SubmenuBorder">
|
|
<Border.RenderTransform>
|
|
<TranslateTransform />
|
|
</Border.RenderTransform>
|
|
<controls:PassiveScrollViewer CanContentScroll="True" Style="{StaticResource UiMenuItemScrollViewer}">
|
|
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
|
|
</controls:PassiveScrollViewer>
|
|
<Border.Effect>
|
|
<DropShadowEffect
|
|
BlurRadius="20"
|
|
Direction="270"
|
|
Opacity="0.25"
|
|
ShadowDepth="6" />
|
|
</Border.Effect>
|
|
</Border>
|
|
</Grid>
|
|
</Popup>
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="Icon" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="IconElement" Value="Collapsed" />
|
|
<Setter Property="Margin" TargetName="IconElement" Value="0" />
|
|
</Trigger>
|
|
<Trigger Property="Header" Value="{x:Null}">
|
|
<Setter Property="Margin" TargetName="IconElement" Value="0" />
|
|
<Setter Property="Visibility" TargetName="HeaderPresenter" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="IsHighlighted" Value="True">
|
|
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorTertiaryBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorDisabled}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
<Trigger Property="IsSubmenuOpen" Value="True">
|
|
<Trigger.EnterActions>
|
|
<BeginStoryboard>
|
|
<Storyboard>
|
|
<DoubleAnimation
|
|
Duration="00:00:00.167"
|
|
From="-90"
|
|
Storyboard.TargetName="SubmenuBorder"
|
|
Storyboard.TargetProperty="(Border.RenderTransform).(TranslateTransform.Y)"
|
|
To="0">
|
|
<DoubleAnimation.EasingFunction>
|
|
<CircleEase EasingMode="EaseOut" />
|
|
</DoubleAnimation.EasingFunction>
|
|
</DoubleAnimation>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</Trigger.EnterActions>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<!-- TopLevelItem -->
|
|
<ControlTemplate TargetType="{x:Type controls:MenuItem}" x:Key="WpfUiMenuItemTopLevelItemTemplateKey">
|
|
<Border
|
|
Background="Transparent"
|
|
CornerRadius="6"
|
|
Margin="4"
|
|
x:Name="Border">
|
|
<Grid Margin="10">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<ContentControl
|
|
Content="{TemplateBinding Icon}"
|
|
FontSize="{TemplateBinding FontSize}"
|
|
Grid.Column="0"
|
|
KeyboardNavigation.IsTabStop="False"
|
|
Margin="0,0,6,0"
|
|
VerticalAlignment="Center"
|
|
x:Name="IconElement" />
|
|
|
|
<ContentPresenter
|
|
ContentSource="Header"
|
|
Grid.Column="2"
|
|
RecognizesAccessKey="True"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
VerticalAlignment="Center"
|
|
x:Name="HeaderPresenter" />
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsHighlighted" Value="True">
|
|
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorTertiaryBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="Icon" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="IconElement" Value="Collapsed" />
|
|
<Setter Property="Margin" TargetName="IconElement" Value="0" />
|
|
</Trigger>
|
|
<Trigger Property="Header" Value="{x:Null}">
|
|
<Setter Property="Margin" TargetName="IconElement" Value="0" />
|
|
<Setter Property="Visibility" TargetName="HeaderPresenter" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorDisabled}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<!-- SubmenuItem -->
|
|
<ControlTemplate TargetType="{x:Type controls:MenuItem}" x:Key="WpfUiMenuItemSubmenuItemTemplateKey">
|
|
<Border
|
|
Background="Transparent"
|
|
CornerRadius="4"
|
|
Margin="4,1,4,1"
|
|
x:Name="Border">
|
|
<Grid Margin="8,6,8,6">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition SharedSizeGroup="Shortcut" Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Border
|
|
BorderThickness="1"
|
|
CornerRadius="4"
|
|
Grid.Column="0"
|
|
Height="16"
|
|
Margin="0"
|
|
VerticalAlignment="Center"
|
|
Visibility="Collapsed"
|
|
Width="16"
|
|
x:Name="CheckBoxIconBorder">
|
|
<TextBlock
|
|
FontFamily="{DynamicResource FluentSystemIcons}"
|
|
FontSize="16"
|
|
HorizontalAlignment="Center"
|
|
Text=""
|
|
TextAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
x:Name="CheckBoxIcon" />
|
|
</Border>
|
|
|
|
<ContentControl
|
|
Content="{TemplateBinding Icon}"
|
|
FontSize="16"
|
|
Grid.Column="1"
|
|
Height="16"
|
|
KeyboardNavigation.IsTabStop="False"
|
|
Margin="0,0,6,0"
|
|
VerticalAlignment="Center"
|
|
Width="16"
|
|
x:Name="IconElement" />
|
|
|
|
<ContentPresenter
|
|
ContentSource="Header"
|
|
Grid.Column="3"
|
|
RecognizesAccessKey="True"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
VerticalAlignment="Center">
|
|
<ContentPresenter.Resources>
|
|
<Style BasedOn="{StaticResource {x:Type TextBlock}}" TargetType="{x:Type TextBlock}">
|
|
<Setter Property="FontSize" Value="12" />
|
|
</Style>
|
|
</ContentPresenter.Resources>
|
|
</ContentPresenter>
|
|
|
|
<TextBlock
|
|
DockPanel.Dock="Right"
|
|
FontSize="11"
|
|
Foreground="{DynamicResource TextFillColorDisabledBrush}"
|
|
Grid.Column="4"
|
|
Margin="25,0,0,0"
|
|
Text="{TemplateBinding InputGestureText}"
|
|
VerticalAlignment="Center"
|
|
x:Name="InputGestureText" />
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsHighlighted" Value="True">
|
|
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorTertiaryBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="Icon" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="IconElement" Value="Hidden" />
|
|
<!-- <Setter TargetName="IconElement" Property="Margin" Value="0" /> -->
|
|
</Trigger>
|
|
<Trigger Property="IsCheckable" Value="True">
|
|
<Setter Property="Visibility" TargetName="IconElement" Value="Collapsed" />
|
|
<Setter Property="Visibility" TargetName="CheckBoxIconBorder" Value="Visible" />
|
|
<Setter Property="Margin" TargetName="CheckBoxIconBorder" Value="0,0,6,0" />
|
|
</Trigger>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter Property="Text" TargetName="CheckBoxIcon" Value="" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorDisabled}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
<Trigger Property="InputGestureText" Value="">
|
|
<Setter Property="Visibility" TargetName="InputGestureText" Value="Collapsed" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<!-- SubItem with Subitems -->
|
|
<ControlTemplate TargetType="{x:Type controls:MenuItem}" x:Key="WpfUiMenuItemSubmenuHeaderTemplateKey">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<Border
|
|
BorderThickness="1"
|
|
CornerRadius="4"
|
|
Grid.Row="1"
|
|
Margin="4,1,4,1"
|
|
x:Name="Border">
|
|
<Grid Margin="8,6,8,6" x:Name="MenuItemContent">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<ContentControl
|
|
Content="{TemplateBinding Icon}"
|
|
FontSize="16"
|
|
Grid.Column="0"
|
|
Height="16"
|
|
KeyboardNavigation.IsTabStop="False"
|
|
Margin="0,0,6,0"
|
|
VerticalAlignment="Center"
|
|
Width="16"
|
|
x:Name="IconElement" />
|
|
|
|
<ContentPresenter
|
|
ContentSource="Header"
|
|
Grid.Column="2"
|
|
RecognizesAccessKey="True"
|
|
x:Name="HeaderHost">
|
|
<ContentPresenter.Resources>
|
|
<Style BasedOn="{StaticResource {x:Type TextBlock}}" TargetType="{x:Type TextBlock}">
|
|
<Setter Property="FontSize" Value="12" />
|
|
</Style>
|
|
</ContentPresenter.Resources>
|
|
</ContentPresenter>
|
|
|
|
<Grid Grid.Column="3">
|
|
<controls:SymbolIcon
|
|
FontSize="12"
|
|
Margin="0,3,0,0"
|
|
Symbol="ChevronRight20"
|
|
VerticalAlignment="Center"
|
|
x:Name="Chevron" />
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<Popup
|
|
AllowsTransparency="True"
|
|
Focusable="False"
|
|
Grid.Row="1"
|
|
IsOpen="{TemplateBinding IsSubmenuOpen}"
|
|
Placement="Right"
|
|
PlacementTarget="{Binding ElementName=MenuItemContent}"
|
|
PopupAnimation="None"
|
|
VerticalOffset="-20"
|
|
x:Name="Popup">
|
|
<Grid>
|
|
<Border
|
|
Background="{DynamicResource AcrylicBackgroundFillColorDefaultBrush}"
|
|
BorderBrush="{DynamicResource SurfaceStrokeColorFlyoutBrush}"
|
|
BorderThickness="1"
|
|
CornerRadius="8"
|
|
Margin="12,10,12,18"
|
|
Padding="0,3,0,3"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="SubmenuBorder">
|
|
<Border.RenderTransform>
|
|
<TranslateTransform />
|
|
</Border.RenderTransform>
|
|
<controls:PassiveScrollViewer CanContentScroll="True" Style="{StaticResource UiMenuItemScrollViewer}">
|
|
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
|
|
</controls:PassiveScrollViewer>
|
|
<Border.Effect>
|
|
<DropShadowEffect
|
|
BlurRadius="20"
|
|
Direction="270"
|
|
Opacity="0.5"
|
|
ShadowDepth="6" />
|
|
</Border.Effect>
|
|
</Border>
|
|
</Grid>
|
|
</Popup>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="Icon" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="IconElement" Value="Hidden" />
|
|
<!-- <Setter TargetName="IconElement" Property="Margin" Value="0" /> -->
|
|
</Trigger>
|
|
<Trigger Property="IsHighlighted" Value="true">
|
|
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorTertiaryBrush}" />
|
|
</Trigger>
|
|
<!--<Trigger SourceName="Popup" Property="AllowsTransparency" Value="True">
|
|
<Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="4" />
|
|
<Setter TargetName="SubmenuBorder" Property="Padding" Value="0,3,0,3" />
|
|
</Trigger>-->
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Foreground">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorDisabled}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Foreground" TargetName="Chevron">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorDisabled}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
<Trigger Property="IsSubmenuOpen" Value="True">
|
|
<Trigger.EnterActions>
|
|
<BeginStoryboard>
|
|
<Storyboard>
|
|
<DoubleAnimation
|
|
Duration="00:00:00.167"
|
|
From="-90"
|
|
Storyboard.TargetName="SubmenuBorder"
|
|
Storyboard.TargetProperty="(Border.RenderTransform).(TranslateTransform.Y)"
|
|
To="0">
|
|
<DoubleAnimation.EasingFunction>
|
|
<CircleEase EasingMode="EaseOut" />
|
|
</DoubleAnimation.EasingFunction>
|
|
</DoubleAnimation>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</Trigger.EnterActions>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<!-- MenuItem Style -->
|
|
<Style TargetType="{x:Type controls:MenuItem}" x:Key="WpfUiMenuItem">
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
|
<Setter Property="KeyboardNavigation.IsTabStop" Value="True" />
|
|
<Setter Property="Focusable" Value="True" />
|
|
<Style.Triggers>
|
|
<Trigger Property="Role" Value="TopLevelHeader">
|
|
<Setter Property="Template" Value="{StaticResource WpfUiMenuItemTopLevelHeaderTemplateKey}" />
|
|
<Setter Property="Grid.IsSharedSizeScope" Value="True" />
|
|
</Trigger>
|
|
<Trigger Property="Role" Value="TopLevelItem">
|
|
<Setter Property="Template" Value="{StaticResource WpfUiMenuItemTopLevelItemTemplateKey}" />
|
|
</Trigger>
|
|
<Trigger Property="Role" Value="SubmenuHeader">
|
|
<Setter Property="Template" Value="{StaticResource WpfUiMenuItemSubmenuHeaderTemplateKey}" />
|
|
</Trigger>
|
|
<Trigger Property="Role" Value="SubmenuItem">
|
|
<Setter Property="Template" Value="{StaticResource WpfUiMenuItemSubmenuItemTemplateKey}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style BasedOn="{StaticResource WpfUiMenuItem}" TargetType="{x:Type controls:MenuItem}" />
|
|
|
|
</ResourceDictionary>
|