Files
ShrlAlgoToolkit/Melskin/Controls/TextBoxContextMenu.xaml
2026-02-12 21:29:00 +08:00

63 lines
2.9 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:Melskin.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type ContextMenu}" x:Key="DefaultTextBoxContextMenuStyle">
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="2,0" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderGradientBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Grid.IsSharedSizeScope" Value="true" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContextMenu}">
<Grid>
<Border
Background="{TemplateBinding Background}"
BorderThickness="0"
CornerRadius="4"
Effect="{DynamicResource PopupShadow}"
Margin="8"
Padding="0"
x:Name="Border">
<StackPanel
IsItemsHost="True"
KeyboardNavigation.DirectionalNavigation="Cycle"
Margin="2,1" />
</Border>
<Rectangle
Margin="8"
RadiusX="4"
RadiusY="4"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ContextMenu Style="{StaticResource DefaultTextBoxContextMenuStyle}" x:Key="TextBoxContextMenu">
<MenuItem Command="ApplicationCommands.Copy">
<MenuItem.Icon>
<controls:IconElement Foreground="{DynamicResource TextPrimaryBrush}" Symbol="ContentCopy" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Cut">
<MenuItem.Icon>
<controls:IconElement Foreground="{DynamicResource TextPrimaryBrush}" Symbol="ContentCut" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Paste">
<MenuItem.Icon>
<controls:IconElement Foreground="{DynamicResource TextPrimaryBrush}" Symbol="ContentPaste" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</ResourceDictionary>