Files
ShrlAlgoToolkit/Melskin/Controls/TextBoxContextMenu.xaml
2026-02-20 15:31:44 +08:00

63 lines
2.9 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Melskin.Controls">
<Style x:Key="DefaultTextBoxContextMenuStyle" TargetType="{x:Type ContextMenu}">
<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
x:Name="Border"
Margin="8"
Padding="0"
Background="{TemplateBinding Background}"
BorderThickness="0"
CornerRadius="4"
Effect="{DynamicResource PopupShadow}">
<StackPanel
Margin="2,1"
IsItemsHost="True"
KeyboardNavigation.DirectionalNavigation="Cycle" />
</Border>
<Rectangle
Margin="8"
RadiusX="4"
RadiusY="4"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ContextMenu x:Key="TextBoxContextMenu" Style="{StaticResource DefaultTextBoxContextMenuStyle}">
<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>