Files
HandyControl/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
T
2020-06-20 18:51:53 +08:00

63 lines
4.1 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="clr-namespace:HandyControl.Controls">
<Style x:Key="DividerBaseStyle" TargetType="hc:Divider">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Margin" Value="0,24"/>
<Setter Property="Padding" Value="24,0"/>
<Setter Property="LineStroke" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="hc:Divider">
<hc:Row>
<hc:Col Layout="12" x:Name="ColStart">
<Line VerticalAlignment="Center" StrokeDashArray="{TemplateBinding LineStrokeDashArray}" Stroke="{TemplateBinding LineStroke}" X2="1" StrokeThickness="{TemplateBinding LineStrokeThickness}" Stretch="Fill" StrokeEndLineCap="Square" StrokeStartLineCap="Square"/>
</hc:Col>
<hc:Col Layout="0">
<ContentPresenter Margin="{TemplateBinding Padding}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
</hc:Col>
<hc:Col Layout="12" x:Name="ColEnd">
<Line VerticalAlignment="Center" StrokeDashArray="{TemplateBinding LineStrokeDashArray}" Stroke="{TemplateBinding LineStroke}" X2="1" StrokeThickness="{TemplateBinding LineStrokeThickness}" Stretch="Fill" StrokeEndLineCap="Square" StrokeStartLineCap="Square"/>
</hc:Col>
</hc:Row>
<ControlTemplate.Triggers>
<Trigger Property="Content" Value="{x:Null}">
<Setter Property="Padding" Value="0"/>
</Trigger>
<Trigger Property="HorizontalContentAlignment" Value="Left">
<Setter TargetName="ColStart" Property="Layout" Value="0"/>
<Setter TargetName="ColStart" Property="IsFixed" Value="True"/>
<Setter TargetName="ColStart" Property="Width" Value="20"/>
<Setter TargetName="ColEnd" Property="Layout" Value="24"/>
</Trigger>
<Trigger Property="HorizontalContentAlignment" Value="Right">
<Setter TargetName="ColEnd" Property="Layout" Value="0"/>
<Setter TargetName="ColEnd" Property="IsFixed" Value="True"/>
<Setter TargetName="ColEnd" Property="Width" Value="20"/>
<Setter TargetName="ColStart" Property="Layout" Value="24"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Content" Value="{x:Null}">
<Setter Property="Padding" Value="0"/>
</Trigger>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Margin" Value="6,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="hc:Divider">
<Line HorizontalAlignment="Center" StrokeDashArray="{TemplateBinding LineStrokeDashArray}" Stroke="{TemplateBinding LineStroke}" Y2="1" StrokeThickness="{TemplateBinding LineStrokeThickness}" Stretch="Fill" StrokeEndLineCap="Square" StrokeStartLineCap="Square"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>