DividerBaseStyle.xaml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:hc="clr-namespace:HandyControl.Controls">
  4. <Style x:Key="DividerBaseStyle" TargetType="hc:Divider">
  5. <Setter Property="Focusable" Value="False"/>
  6. <Setter Property="Margin" Value="0,24"/>
  7. <Setter Property="Padding" Value="24,0"/>
  8. <Setter Property="LineStroke" Value="{DynamicResource BorderBrush}"/>
  9. <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
  10. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  11. <Setter Property="Template">
  12. <Setter.Value>
  13. <ControlTemplate TargetType="hc:Divider">
  14. <hc:Row>
  15. <hc:Col Layout="12" x:Name="ColStart">
  16. <Line VerticalAlignment="Center" StrokeDashArray="{TemplateBinding LineStrokeDashArray}" Stroke="{TemplateBinding LineStroke}" X2="1" StrokeThickness="{TemplateBinding LineStrokeThickness}" Stretch="Fill" StrokeEndLineCap="Square" StrokeStartLineCap="Square"/>
  17. </hc:Col>
  18. <hc:Col IsFixed="True">
  19. <ContentPresenter Margin="{TemplateBinding Padding}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
  20. </hc:Col>
  21. <hc:Col Layout="12" x:Name="ColEnd">
  22. <Line VerticalAlignment="Center" StrokeDashArray="{TemplateBinding LineStrokeDashArray}" Stroke="{TemplateBinding LineStroke}" X2="1" StrokeThickness="{TemplateBinding LineStrokeThickness}" Stretch="Fill" StrokeEndLineCap="Square" StrokeStartLineCap="Square"/>
  23. </hc:Col>
  24. </hc:Row>
  25. <ControlTemplate.Triggers>
  26. <Trigger Property="Content" Value="{x:Null}">
  27. <Setter Property="Padding" Value="0"/>
  28. </Trigger>
  29. <Trigger Property="HorizontalContentAlignment" Value="Left">
  30. <Setter TargetName="ColStart" Property="Layout" Value="0"/>
  31. <Setter TargetName="ColStart" Property="IsFixed" Value="True"/>
  32. <Setter TargetName="ColStart" Property="Width" Value="20"/>
  33. <Setter TargetName="ColEnd" Property="Layout" Value="24"/>
  34. </Trigger>
  35. <Trigger Property="HorizontalContentAlignment" Value="Right">
  36. <Setter TargetName="ColEnd" Property="Layout" Value="0"/>
  37. <Setter TargetName="ColEnd" Property="IsFixed" Value="True"/>
  38. <Setter TargetName="ColEnd" Property="Width" Value="20"/>
  39. <Setter TargetName="ColStart" Property="Layout" Value="24"/>
  40. </Trigger>
  41. </ControlTemplate.Triggers>
  42. </ControlTemplate>
  43. </Setter.Value>
  44. </Setter>
  45. <Style.Triggers>
  46. <Trigger Property="Content" Value="{x:Null}">
  47. <Setter Property="Padding" Value="0"/>
  48. </Trigger>
  49. <Trigger Property="Orientation" Value="Vertical">
  50. <Setter Property="Margin" Value="6,0"/>
  51. <Setter Property="Template">
  52. <Setter.Value>
  53. <ControlTemplate TargetType="hc:Divider">
  54. <Line HorizontalAlignment="Center" StrokeDashArray="{TemplateBinding LineStrokeDashArray}" Stroke="{TemplateBinding LineStroke}" Y2="1" StrokeThickness="{TemplateBinding LineStrokeThickness}" Stretch="Fill" StrokeEndLineCap="Square" StrokeStartLineCap="Square"/>
  55. </ControlTemplate>
  56. </Setter.Value>
  57. </Setter>
  58. </Trigger>
  59. </Style.Triggers>
  60. </Style>
  61. </ResourceDictionary>