2025-08-20 12:10:13 +08:00
|
|
|
|
<ResourceDictionary
|
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
2026-01-02 17:30:41 +08:00
|
|
|
|
xmlns:controls="clr-namespace:Melskin.Controls"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
2025-09-06 00:36:23 +08:00
|
|
|
|
<Style TargetType="{x:Type controls:Divider}">
|
2025-08-25 17:30:53 +08:00
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource DividerBrush}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
2025-09-06 00:36:23 +08:00
|
|
|
|
<ControlTemplate TargetType="{x:Type controls:Divider}">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Grid>
|
|
|
|
|
|
<!-- 唯一的水平布局容器,智能且优雅 -->
|
|
|
|
|
|
<Grid x:Name="HorizontalLayout">
|
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
|
<!-- 定义三列并给它们命名,以便在Trigger中引用 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<ColumnDefinition Width="*" x:Name="ColumnLeft" />
|
|
|
|
|
|
<ColumnDefinition Width="Auto" x:Name="ColumnContent" />
|
|
|
|
|
|
<ColumnDefinition Width="*" x:Name="ColumnRight" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
|
|
|
|
|
|
<Rectangle
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Fill="{TemplateBinding Foreground}"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Height="1"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="0,0,16,0" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<ContentPresenter
|
2026-01-02 17:30:30 +08:00
|
|
|
|
ContentSource="Content"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
Grid.Column="1"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
TextElement.Foreground="{DynamicResource TextSecondaryBrush}"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
VerticalAlignment="Center"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="ContentHost" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Rectangle
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Fill="{TemplateBinding Foreground}"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
Grid.Column="2"
|
|
|
|
|
|
Height="1"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="16,0,0,0" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 唯一的垂直线条 -->
|
|
|
|
|
|
<Rectangle
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Fill="{TemplateBinding Foreground}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Visibility="Collapsed"
|
|
|
|
|
|
Width="1"
|
|
|
|
|
|
x:Name="VerticalLayout" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
|
<!-- 当文本居左时,改变列的宽度定义 -->
|
|
|
|
|
|
<Trigger Property="TextOrientation" Value="Left">
|
|
|
|
|
|
<!-- 左列变为固定宽度,右列填满剩余空间 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Width" TargetName="ColumnLeft" Value="40" />
|
|
|
|
|
|
<Setter Property="Width" TargetName="ColumnRight" Value="*" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 当文本居右时,改变列的宽度定义 -->
|
|
|
|
|
|
<Trigger Property="TextOrientation" Value="Right">
|
|
|
|
|
|
<!-- 左列填满剩余空间,右列变为固定宽度 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Width" TargetName="ColumnLeft" Value="*" />
|
|
|
|
|
|
<Setter Property="Width" TargetName="ColumnRight" Value="40" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 当方向为垂直时,切换布局 -->
|
|
|
|
|
|
<Trigger Property="Orientation" Value="Vertical">
|
|
|
|
|
|
<Setter Property="Margin" Value="8,0" />
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Visibility" TargetName="HorizontalLayout" Value="Collapsed" />
|
|
|
|
|
|
<Setter Property="Visibility" TargetName="VerticalLayout" Value="Visible" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 当无内容时,隐藏内容区域 -->
|
|
|
|
|
|
<Trigger Property="Content" Value="{x:Null}">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Visibility" TargetName="ContentHost" Value="Collapsed" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
</ResourceDictionary>
|