Sic10/SicUI/Styles/MenuItem.xaml

463 lines
23 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<ControlTemplate x:Key="SubMenuItem" TargetType="{x:Type MenuItem}">
<ControlTemplate.Resources>
<Storyboard x:Key="SubMenuOnMouseOver">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="HighLight" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0" Value="0" />
<SplineDoubleKeyFrame
KeySpline="0,0,1,0"
KeyTime="0:0:0.2"
Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="SubMenuOnMouseOut">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="HighLight" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0" Value="1" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="0:0:0.2"
Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Grid Margin="0,3" SnapsToDevicePixels="true">
<Rectangle
x:Name="HighLight"
Margin="-2,-2,-3,2"
Fill="{DynamicResource Color_BG_SubMenu_OnMouseOver}"
Opacity="0" />
<ContentPresenter
x:Name="contentPresenter"
Grid.Column="0"
Margin="16,0"
VerticalAlignment="Center"
ContentSource="Header"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Rectangle
Height="1"
VerticalAlignment="Bottom"
Fill="{DynamicResource Color_BG_SubMenu_LineHighlight}">
<Rectangle.OpacityMask>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Offset="0" />
<GradientStop Offset="1" />
<GradientStop Offset="0.2" Color="White" />
<GradientStop Offset="0.8" Color="White" />
</LinearGradientBrush>
</Rectangle.OpacityMask>
</Rectangle>
<Rectangle
Height="1"
Margin="0,0,0,2"
VerticalAlignment="Bottom"
Fill="{DynamicResource Color_BG_SubMenu_LineShadow}"
StrokeThickness="2">
<Rectangle.OpacityMask>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Offset="0" />
<GradientStop Offset="1" />
<GradientStop Offset="0.2" Color="White" />
<GradientStop Offset="0.8" Color="White" />
</LinearGradientBrush>
</Rectangle.OpacityMask>
</Rectangle>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Icon" Value="{x:Null}" />
<Trigger Property="IsChecked" Value="true" />
<Trigger Property="IsHighlighted" Value="true">
<Trigger.ExitActions>
<BeginStoryboard x:Name="SubMenuOnMouseOut_BeginStoryboard" Storyboard="{StaticResource SubMenuOnMouseOut}" />
</Trigger.ExitActions>
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource SubMenuOnMouseOver}" />
</Trigger.EnterActions>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#FF9A9A9A" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
<MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter" />
<Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>
<Style
x:Key="MenuScrollButton"
BasedOn="{x:Null}"
TargetType="{x:Type RepeatButton}">
<Setter Property="ClickMode" Value="Hover" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<DockPanel Background="Transparent" SnapsToDevicePixels="true">
<Rectangle
x:Name="R1"
Width="1"
DockPanel.Dock="Right"
Fill="Transparent" />
<Rectangle
x:Name="B1"
Height="1"
DockPanel.Dock="Bottom"
Fill="Transparent" />
<Rectangle
x:Name="L1"
Width="1"
DockPanel.Dock="Left"
Fill="Transparent" />
<Rectangle
x:Name="T1"
Height="1"
DockPanel.Dock="Top"
Fill="Transparent" />
<ContentPresenter
x:Name="ContentContainer"
Margin="2,2,2,2"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="R1" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" />
<Setter TargetName="B1" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" />
<Setter TargetName="L1" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" />
<Setter TargetName="T1" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" />
<Setter TargetName="ContentContainer" Property="Margin" Value="3,3,1,1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="{ComponentResourceKey ResourceId=MenuScrollViewer,
TypeInTargetAssembly={x:Type FrameworkElement}}"
BasedOn="{x:Null}"
TargetType="{x:Type ScrollViewer}">
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollViewer}">
<Grid SnapsToDevicePixels="true">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.Row="1" Grid.Column="0">
<ScrollContentPresenter Margin="{TemplateBinding Padding}" />
</Border>
<RepeatButton
Grid.Row="0"
Grid.Column="0"
Command="{x:Static ScrollBar.LineUpCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Focusable="false"
Style="{StaticResource MenuScrollButton}">
<RepeatButton.Visibility>
<MultiBinding
Converter="{StaticResource MenuScrollingVisibilityConverter}"
ConverterParameter="0"
FallbackValue="Visibility.Collapsed">
<Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</RepeatButton.Visibility>
<Path Data="{StaticResource UpArrow}" Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" />
</RepeatButton>
<RepeatButton
Grid.Row="2"
Grid.Column="0"
Command="{x:Static ScrollBar.LineDownCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Focusable="false"
Style="{StaticResource MenuScrollButton}">
<RepeatButton.Visibility>
<MultiBinding
Converter="{StaticResource MenuScrollingVisibilityConverter}"
ConverterParameter="100"
FallbackValue="Visibility.Collapsed">
<Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</RepeatButton.Visibility>
<Path Data="{StaticResource DownArrow}" Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" />
</RepeatButton>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}" TargetType="{x:Type ContentControl}">
<Border
MinWidth="{TemplateBinding ActualWidth}"
Padding="5,0"
Background="{DynamicResource Color_BG_SubMenuBG}"
BorderBrush="{DynamicResource Color_BD_SubMenu}"
BorderThickness="1"
SnapsToDevicePixels="True">
<ContentPresenter Margin="0,5" HorizontalAlignment="Left" />
</Border>
</ControlTemplate>
<ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
<ControlTemplate.Resources>
<Storyboard x:Key="OnMouseOver">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Highlight" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0" Value="0" />
<SplineDoubleKeyFrame
KeySpline="0,0,1,0"
KeyTime="0:0:0.2"
Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="OnMouseOut">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Highlight" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0" Value="1" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="0:0:0.2"
Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Grid SnapsToDevicePixels="true">
<Border
x:Name="BG"
Background="{DynamicResource Color_BG_Menu}"
BorderBrush="{DynamicResource Color_BD_Menu}"
BorderThickness="1"
Cursor="Hand">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
ShadowDepth="0"
Color="#FFC6E9FF" />
</Border.Effect>
<Grid>
<Border
x:Name="Highlight"
Background="{DynamicResource Color_BG_Menu_Highlight}"
Opacity="0">
<Border.Effect>
<BlurEffect />
</Border.Effect>
</Border>
</Grid>
</Border>
<ContentPresenter
x:Name="contentPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ContentSource="Header"
Cursor="Hand"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Popup
x:Name="PART_Popup"
Grid.Column="1"
MinWidth="150"
AllowsTransparency="true"
Focusable="false"
HorizontalOffset="1"
IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
Placement="Bottom"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
VerticalOffset="2">
<ContentControl
x:Name="SubMenuBorder"
IsTabStop="false"
Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent,
TypeInTargetAssembly={x:Type FrameworkElement}}}">
<ScrollViewer CanContentScroll="true" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
<ItemsPresenter
Margin="2"
Cursor="Hand"
Grid.IsSharedSizeScope="true"
KeyboardNavigation.DirectionalNavigation="Cycle"
KeyboardNavigation.TabNavigation="Cycle"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</ContentControl>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
<Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None" />
</Trigger>
<Trigger Property="Icon" Value="{x:Null}" />
<Trigger Property="IsChecked" Value="true" />
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true" />
<Trigger Property="IsHighlighted" Value="true">
<Trigger.ExitActions>
<BeginStoryboard x:Name="OnMouseOut_BeginStoryboard1" Storyboard="{StaticResource OnMouseOut}" />
</Trigger.ExitActions>
<Trigger.EnterActions>
<BeginStoryboard x:Name="OnMouseOver_BeginStoryboard" Storyboard="{StaticResource OnMouseOver}" />
</Trigger.EnterActions>
</Trigger>
<DataTrigger Binding="{Binding Selected}" Value="True">
<Setter TargetName="Highlight" Property="Opacity" Value="1" />
</DataTrigger>
<Trigger Property="IsKeyboardFocused" Value="true" />
<Trigger Property="IsSubmenuOpen" Value="true" />
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#FF9A9A9A" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<SolidColorBrush x:Key="Menu_Main_BD" Color="#FF3EAFE2" />
<SolidColorBrush x:Key="Menu_Main_BG" Color="#FF0C1F6B" />
<SolidColorBrush x:Key="Menu_Main_BG_Highlight" Color="#FF2DACCB" />
<ControlTemplate x:Key="SubMunu_ShowOnTop" TargetType="{x:Type MenuItem}">
<Grid SnapsToDevicePixels="true">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition MinWidth="70" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<Path
Data="M19.5,44.5 L10.25,44.5 0.5,34.75 0.5,10.25 10.25,0.5 19.5,0.5"
Stretch="Fill"
Stroke="{DynamicResource Menu_Main_BD}" />
<Path
x:Name="Left_Path"
Margin="4,4,0,4"
Data="M19.5,44.5 L10.25,44.5 0.5,34.75 0.5,10.25 10.25,0.5 19.5,0.5"
Fill="{DynamicResource Menu_Main_BG}"
Stretch="Fill"
Stroke="{DynamicResource Menu_Main_BD}" />
<Path
Grid.Column="2"
Data="M19.5,44.5 L10.25,44.5 0.5,34.75 0.5,10.25 10.25,0.5 19.5,0.5"
RenderTransformOrigin="0.5,0.5"
Stretch="Fill"
Stroke="{DynamicResource Menu_Main_BD}">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="-1" ScaleY="1" />
<SkewTransform AngleX="0" AngleY="0" />
<RotateTransform Angle="0" />
<TranslateTransform />
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path
x:Name="Right_Path"
Grid.Column="2"
Margin="0,4,4,4"
Data="M19.5,44.5 L10.25,44.5 0.5,34.75 0.5,10.25 10.25,0.5 19.5,0.5"
Fill="{DynamicResource Menu_Main_BG}"
RenderTransformOrigin="0.5,0.5"
Stretch="Fill"
Stroke="{DynamicResource Menu_Main_BD}">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="-1" ScaleY="1" />
<SkewTransform AngleX="0" AngleY="0" />
<RotateTransform Angle="0" />
<TranslateTransform />
</TransformGroup>
</Path.RenderTransform>
</Path>
<Border
Grid.Column="1"
Margin="-2,0"
BorderBrush="{DynamicResource Menu_Main_BD}"
BorderThickness="0,1">
<Border
x:Name="BG"
Grid.Column="1"
Margin="0,3"
Background="{DynamicResource Menu_Main_BG}"
BorderBrush="{DynamicResource Menu_Main_BD}"
BorderThickness="0,1">
<ContentPresenter
x:Name="contentPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ContentSource="Header"
Cursor="Hand"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Border>
<Popup
x:Name="PART_Popup"
Grid.Column="1"
MinWidth="150"
AllowsTransparency="true"
Focusable="false"
HorizontalOffset="0"
IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
Placement="Top"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
VerticalOffset="-2">
<ContentControl
x:Name="SubMenuBorder"
IsTabStop="false"
Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent,
TypeInTargetAssembly={x:Type FrameworkElement}}}">
<ScrollViewer CanContentScroll="true" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
<ItemsPresenter
Margin="2"
Cursor="Hand"
Grid.IsSharedSizeScope="true"
KeyboardNavigation.DirectionalNavigation="Cycle"
KeyboardNavigation.TabNavigation="Cycle"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</ContentControl>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
<Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None" />
</Trigger>
<Trigger Property="Icon" Value="{x:Null}" />
<Trigger Property="IsChecked" Value="true" />
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true" />
<Trigger Property="IsHighlighted" Value="true">
<Setter TargetName="Left_Path" Property="Fill" Value="{DynamicResource Menu_Main_BG_Highlight}" />
<Setter TargetName="Right_Path" Property="Fill" Value="{DynamicResource Menu_Main_BG_Highlight}" />
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Menu_Main_BG_Highlight}" />
</Trigger>
<DataTrigger Binding="{Binding Selected}" Value="True">
<Setter TargetName="Left_Path" Property="Fill" Value="{DynamicResource Menu_Main_BG_Highlight}" />
<Setter TargetName="Right_Path" Property="Fill" Value="{DynamicResource Menu_Main_BG_Highlight}" />
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Menu_Main_BG_Highlight}" />
</DataTrigger>
<Trigger Property="IsKeyboardFocused" Value="true" />
<Trigger Property="IsSubmenuOpen" Value="true" />
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#FF9A9A9A" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ResourceDictionary>