Files
Shrlalgo.RvKits/WPFluent/Controls/ContextMenu/ContextMenu.xaml
ShrlAlgo 4d35cadb56 更新
2025-07-11 09:20:23 +08:00

63 lines
3.3 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type ContextMenu}" x:Key="UiContextMenu">
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource AcrylicBackgroundFillColorDefaultBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource SurfaceStrokeColorFlyoutBrush}" />
<Setter Property="MinWidth" Value="140" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" />
<Setter Property="HasDropShadow" Value="False" />
<Setter Property="Grid.IsSharedSizeScope" Value="True" />
<Setter Property="Popup.PopupAnimation" Value="None" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContextMenu}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
CornerRadius="8"
Padding="0,3,0,3"
x:Name="Border">
<Border.RenderTransform>
<TranslateTransform />
</Border.RenderTransform>
<StackPanel
ClipToBounds="True"
IsItemsHost="True"
KeyboardNavigation.DirectionalNavigation="Cycle"
Orientation="Vertical" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsOpen" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Duration="00:00:00.167"
From="-90"
Storyboard.TargetName="Border"
Storyboard.TargetProperty="(Border.RenderTransform).(TranslateTransform.Y)"
To="0">
<DoubleAnimation.EasingFunction>
<CircleEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource UiContextMenu}" TargetType="{x:Type ContextMenu}" />
</ResourceDictionary>