Files
ShrlAlgoToolkit/Melskin/Controls/Separator.xaml
2026-02-17 22:17:13 +08:00

57 lines
2.4 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- 水平分割 -->
<Style x:Key="HorizontalSeparatorStyle" TargetType="{x:Type Separator}">
<Setter Property="Background" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="Margin" Value="0,4" />
<Setter Property="Focusable" Value="false" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Separator}">
<Border
Height="1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="true" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 默认水平分割 -->
<Style BasedOn="{StaticResource HorizontalSeparatorStyle}" TargetType="{x:Type Separator}" />
<!-- 菜单分隔 -->
<Style
x:Key="{x:Static MenuItem.SeparatorStyleKey}"
BasedOn="{StaticResource HorizontalSeparatorStyle}"
TargetType="{x:Type Separator}">
<Setter Property="Margin" Value="0,2" />
</Style>
<!-- 垂直分割 -->
<Style x:Key="VerticalSeparatorStyle" TargetType="{x:Type Separator}">
<Setter Property="Background" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="Margin" Value="2,0" />
<Setter Property="Focusable" Value="false" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Separator}">
<Border
Width="1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="true" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 状态栏分割 -->
<Style
x:Key="{x:Static StatusBar.SeparatorStyleKey}"
BasedOn="{StaticResource VerticalSeparatorStyle}"
TargetType="{x:Type Separator}">
<Setter Property="Margin" Value="4,2" />
</Style>
</ResourceDictionary>