StepBarBaseStyle.xaml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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="StepBarItemBaseStyle" TargetType="hc:StepBarItem">
  5. <Setter Property="Focusable" Value="False"/>
  6. <Setter Property="Foreground" Value="{DynamicResource ThirdlyTextBrush}"/>
  7. <Style.Triggers>
  8. <Trigger Property="Status" Value="Complete">
  9. <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
  10. </Trigger>
  11. <Trigger Property="Status" Value="UnderWay">
  12. <Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
  13. </Trigger>
  14. <Trigger Property="Status" Value="Waiting">
  15. <Setter Property="Foreground" Value="{DynamicResource ThirdlyTextBrush}"/>
  16. </Trigger>
  17. </Style.Triggers>
  18. </Style>
  19. <Style x:Key="StepBarItemHorizontalTop" BasedOn="{StaticResource StepBarItemBaseStyle}" TargetType="hc:StepBarItem">
  20. <Setter Property="Margin" Value="10,0"/>
  21. <Setter Property="Template">
  22. <Setter.Value>
  23. <ControlTemplate TargetType="hc:StepBarItem">
  24. <Border Background="Transparent">
  25. <StackPanel>
  26. <Border Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center" CornerRadius="12" BorderThickness="2" BorderBrush="{TemplateBinding Foreground}" Height="24" MinWidth="24">
  27. <TextBlock Foreground="{TemplateBinding Foreground}" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Index,RelativeSource={RelativeSource TemplatedParent}}"/>
  28. </Border>
  29. <ContentPresenter HorizontalAlignment="Center" ContentTemplate="{Binding ItemTemplate,RelativeSource={RelativeSource AncestorType=hc:StepBar}}" TextElement.Foreground="{TemplateBinding Foreground}" Margin="0,4,0,0"/>
  30. </StackPanel>
  31. </Border>
  32. </ControlTemplate>
  33. </Setter.Value>
  34. </Setter>
  35. </Style>
  36. <Style x:Key="StepBarItemHorizontalBottom" BasedOn="{StaticResource StepBarItemBaseStyle}" TargetType="hc:StepBarItem">
  37. <Setter Property="Margin" Value="10,0"/>
  38. <Setter Property="Template">
  39. <Setter.Value>
  40. <ControlTemplate TargetType="hc:StepBarItem">
  41. <StackPanel>
  42. <ContentPresenter HorizontalAlignment="Center" ContentTemplate="{Binding ItemTemplate,RelativeSource={RelativeSource AncestorType=hc:StepBar}}" TextElement.Foreground="{TemplateBinding Foreground}" Margin="0,0,0,4"/>
  43. <Border Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center" CornerRadius="12" BorderThickness="2" BorderBrush="{TemplateBinding Foreground}" Height="24" MinWidth="24">
  44. <TextBlock Foreground="{TemplateBinding Foreground}" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Index,RelativeSource={RelativeSource TemplatedParent}}"/>
  45. </Border>
  46. </StackPanel>
  47. </ControlTemplate>
  48. </Setter.Value>
  49. </Setter>
  50. </Style>
  51. <Style x:Key="StepBarItemVertical" BasedOn="{StaticResource StepBarItemBaseStyle}" TargetType="hc:StepBarItem">
  52. <Setter Property="Margin" Value="0, 10"/>
  53. <Setter Property="Template">
  54. <Setter.Value>
  55. <ControlTemplate TargetType="hc:StepBarItem">
  56. <StackPanel Orientation="Horizontal">
  57. <Border Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center" CornerRadius="12" BorderThickness="2" BorderBrush="{TemplateBinding Foreground}" Height="24" MinWidth="24">
  58. <TextBlock Foreground="{TemplateBinding Foreground}" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Index,RelativeSource={RelativeSource TemplatedParent}}"/>
  59. </Border>
  60. <ContentPresenter HorizontalAlignment="Left" ContentTemplate="{Binding ItemTemplate,RelativeSource={RelativeSource AncestorType=hc:StepBar}}" TextElement.Foreground="{TemplateBinding Foreground}" Margin="10,4,0,0"/>
  61. </StackPanel>
  62. </ControlTemplate>
  63. </Setter.Value>
  64. </Setter>
  65. </Style>
  66. <ControlTemplate x:Key="StepBarHorizontalTopControlTemplate" TargetType="hc:StepBar">
  67. <hc:SimplePanel>
  68. <ProgressBar HorizontalAlignment="Center" Name="PART_ProgressBarBack" VerticalAlignment="Top" Margin="0,10,0,0" Style="{StaticResource ProgressBarFlat}" Background="{DynamicResource ThirdlyTextBrush}"/>
  69. <ItemsPresenter/>
  70. </hc:SimplePanel>
  71. </ControlTemplate>
  72. <ControlTemplate x:Key="StepBarHorizontalBottomControlTemplate" TargetType="hc:StepBar">
  73. <hc:SimplePanel>
  74. <ProgressBar HorizontalAlignment="Center" Name="PART_ProgressBarBack" VerticalAlignment="Bottom" Margin="0,0,0,10" Style="{StaticResource ProgressBarFlat}" Background="{DynamicResource ThirdlyTextBrush}"/>
  75. <ItemsPresenter VerticalAlignment="Bottom"/>
  76. </hc:SimplePanel>
  77. </ControlTemplate>
  78. <ControlTemplate x:Key="StepBarVerticalControlTemplate" TargetType="hc:StepBar">
  79. <hc:SimplePanel>
  80. <ProgressBar Orientation="Vertical" Width="4" HorizontalAlignment="Left" Name="PART_ProgressBarBack" VerticalAlignment="Center" Margin="10,0,0,0" Style="{StaticResource ProgressBarFlat}" Background="{DynamicResource ThirdlyTextBrush}" RenderTransformOrigin="0.5,0.5">
  81. <ProgressBar.RenderTransform>
  82. <TransformGroup>
  83. <RotateTransform Angle="180"/>
  84. </TransformGroup>
  85. </ProgressBar.RenderTransform>
  86. </ProgressBar>
  87. <ItemsPresenter/>
  88. </hc:SimplePanel>
  89. </ControlTemplate>
  90. <Style x:Key="StepBarBaseStyle" TargetType="hc:StepBar">
  91. <Setter Property="Focusable" Value="False"/>
  92. <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalTop}"/>
  93. <Setter Property="Template" Value="{StaticResource StepBarHorizontalTopControlTemplate}"/>
  94. <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}"/>
  95. <Style.Triggers>
  96. <Trigger Property="Dock" Value="Left">
  97. <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVertical}"/>
  98. <Setter Property="Template" Value="{StaticResource StepBarVerticalControlTemplate}"/>
  99. <Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}"/>
  100. </Trigger>
  101. <Trigger Property="Dock" Value="Bottom">
  102. <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalBottom}"/>
  103. <Setter Property="Template" Value="{StaticResource StepBarHorizontalBottomControlTemplate}"/>
  104. <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}"/>
  105. </Trigger>
  106. <Trigger Property="Dock" Value="Right">
  107. <Setter Property="FlowDirection" Value="RightToLeft"/>
  108. <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVertical}"/>
  109. <Setter Property="Template" Value="{StaticResource StepBarVerticalControlTemplate}"/>
  110. <Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}"/>
  111. </Trigger>
  112. </Style.Triggers>
  113. </Style>
  114. </ResourceDictionary>