StepControlStyle.xaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:converter="clr-namespace:PDF_Master.DataConvert"
  5. xmlns:local="clr-namespace:PDF_Master.CustomControl">
  6. <converter:IsLastItemConverter x:Key="IsLastItemConverter" />
  7. <converter:IsProgressedConverter x:Key="IsProgressedConverter" />
  8. <Style TargetType="{x:Type local:StepBarItem}">
  9. <Setter Property="Template">
  10. <Setter.Value>
  11. <ControlTemplate TargetType="{x:Type local:StepBarItem}">
  12. <Grid>
  13. <Grid.ColumnDefinitions>
  14. <ColumnDefinition Width="auto" />
  15. <ColumnDefinition Width="*" />
  16. </Grid.ColumnDefinitions>
  17. <StackPanel Orientation="Horizontal">
  18. <ContentPresenter VerticalAlignment="Center" Visibility="Collapsed" />
  19. <Grid>
  20. <!--<TextBlock
  21. x:Name="path"
  22. HorizontalAlignment="Center"
  23. VerticalAlignment="Center"
  24. FontFamily="{StaticResource FontAwesome}"
  25. FontSize="20"
  26. FontWeight="Light"
  27. Foreground="{TemplateBinding Foreground}"
  28. Text="&#xf05d;"
  29. Visibility="Collapsed" />-->
  30. <!--<Button
  31. Name="BtnIcon"
  32. Width="30"
  33. Height="30"
  34. Background="LightBlue"
  35. BorderBrush="Black"
  36. BorderThickness="1"
  37. Content="{Binding Path=Number, RelativeSource={RelativeSource TemplatedParent}}">
  38. <Button.Template>
  39. <ControlTemplate TargetType="Button">
  40. <Border
  41. Background="{TemplateBinding Background}"
  42. BorderBrush="{TemplateBinding BorderBrush}"
  43. BorderThickness="{TemplateBinding BorderThickness}"
  44. CornerRadius="15">
  45. <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
  46. </Border>
  47. </ControlTemplate>
  48. </Button.Template>
  49. </Button>-->
  50. <Ellipse
  51. Name="BtnIcon"
  52. Width="24"
  53. Height="23"
  54. Fill="LightBlue"
  55. Stroke="Black"
  56. StrokeThickness="0" />
  57. <TextBlock
  58. HorizontalAlignment="Center"
  59. VerticalAlignment="Center"
  60. FontSize="14"
  61. Foreground="White"
  62. Text="{Binding Path=Number, RelativeSource={RelativeSource TemplatedParent}}" />
  63. </Grid>
  64. </StackPanel>
  65. <Border
  66. x:Name="Line"
  67. Grid.Column="1"
  68. MinWidth="{Binding LineMinLength, RelativeSource={RelativeSource AncestorType=local:StepBar}}"
  69. Margin="0"
  70. VerticalAlignment="Center"
  71. BorderBrush="{Binding UnActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}"
  72. BorderThickness="0,2,0,0"
  73. SnapsToDevicePixels="True"
  74. UseLayoutRounding="True"
  75. Visibility="Collapsed" />
  76. </Grid>
  77. <ControlTemplate.Triggers>
  78. <DataTrigger Value="True">
  79. <DataTrigger.Binding>
  80. <MultiBinding Converter="{StaticResource IsLastItemConverter}">
  81. <Binding RelativeSource="{RelativeSource Self}" />
  82. <Binding Path="Items.Count" RelativeSource="{RelativeSource AncestorType={x:Type local:StepBar}}" />
  83. </MultiBinding>
  84. </DataTrigger.Binding>
  85. <Setter TargetName="Line" Property="Visibility" Value="Collapsed" />
  86. <Setter Property="HorizontalAlignment" Value="Left" />
  87. </DataTrigger>
  88. <DataTrigger Value="False">
  89. <DataTrigger.Binding>
  90. <MultiBinding Converter="{StaticResource IsLastItemConverter}">
  91. <Binding RelativeSource="{RelativeSource Self}" />
  92. <Binding Path="Items.Count" RelativeSource="{RelativeSource AncestorType={x:Type local:StepBar}}" />
  93. </MultiBinding>
  94. </DataTrigger.Binding>
  95. <Setter TargetName="Line" Property="Visibility" Value="Visible" />
  96. </DataTrigger>
  97. <DataTrigger Value="Less">
  98. <DataTrigger.Binding>
  99. <MultiBinding Converter="{StaticResource IsProgressedConverter}">
  100. <Binding RelativeSource="{RelativeSource Self}" />
  101. <Binding Path="CurrentIndex" RelativeSource="{RelativeSource AncestorType={x:Type local:StepBar}}" />
  102. </MultiBinding>
  103. </DataTrigger.Binding>
  104. <Setter TargetName="Line" Property="BorderBrush" Value="{Binding ActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  105. <Setter TargetName="BtnIcon" Property="Fill" Value="{Binding ActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  106. <Setter Property="Foreground" Value="{Binding ActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  107. </DataTrigger>
  108. <DataTrigger Value="Equal">
  109. <DataTrigger.Binding>
  110. <MultiBinding Converter="{StaticResource IsProgressedConverter}">
  111. <Binding RelativeSource="{RelativeSource Self}" />
  112. <Binding Path="CurrentIndex" RelativeSource="{RelativeSource AncestorType={x:Type local:StepBar}}" />
  113. </MultiBinding>
  114. </DataTrigger.Binding>
  115. <Setter TargetName="Line" Property="BorderBrush" Value="{Binding UnActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  116. <Setter TargetName="BtnIcon" Property="Fill" Value="{Binding ActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  117. <Setter Property="Foreground" Value="{Binding ActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  118. </DataTrigger>
  119. <DataTrigger Value="Large">
  120. <DataTrigger.Binding>
  121. <MultiBinding Converter="{StaticResource IsProgressedConverter}">
  122. <Binding RelativeSource="{RelativeSource Self}" />
  123. <Binding Path="CurrentIndex" RelativeSource="{RelativeSource AncestorType={x:Type local:StepBar}}" />
  124. </MultiBinding>
  125. </DataTrigger.Binding>
  126. <Setter TargetName="Line" Property="BorderBrush" Value="{Binding UnActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  127. <Setter TargetName="BtnIcon" Property="Fill" Value="{Binding UnActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  128. <Setter Property="Foreground" Value="{Binding UnActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  129. </DataTrigger>
  130. </ControlTemplate.Triggers>
  131. </ControlTemplate>
  132. </Setter.Value>
  133. </Setter>
  134. <Style.Triggers>
  135. <DataTrigger Binding="{Binding Orientation, RelativeSource={RelativeSource AncestorType=local:StepBar}}" Value="Vertical">
  136. <Setter Property="Template">
  137. <Setter.Value>
  138. <ControlTemplate TargetType="{x:Type local:StepBarItem}">
  139. <Grid>
  140. <Grid.RowDefinitions>
  141. <RowDefinition Height="auto" />
  142. <RowDefinition Height="*" />
  143. </Grid.RowDefinitions>
  144. <StackPanel Orientation="Vertical">
  145. <Grid Margin="0,0,0,0">
  146. <TextBlock
  147. x:Name="path"
  148. HorizontalAlignment="Center"
  149. VerticalAlignment="Center"
  150. FontFamily="{StaticResource FontAwesome}"
  151. FontSize="20"
  152. FontWeight="Thin"
  153. Foreground="{TemplateBinding Foreground}"
  154. Text="&#xf05d;"
  155. Visibility="Collapsed" />
  156. </Grid>
  157. <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
  158. </StackPanel>
  159. <Border
  160. x:Name="Line"
  161. Grid.Row="1"
  162. MinHeight="{Binding LineMinLength, RelativeSource={RelativeSource AncestorType=local:StepBar}}"
  163. Margin="13,0,0,0"
  164. VerticalAlignment="Center"
  165. BorderBrush="{Binding UnActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}"
  166. BorderThickness="1,0,0,0"
  167. SnapsToDevicePixels="True"
  168. UseLayoutRounding="True"
  169. Visibility="Collapsed" />
  170. </Grid>
  171. <ControlTemplate.Triggers>
  172. <DataTrigger Value="True">
  173. <DataTrigger.Binding>
  174. <MultiBinding Converter="{StaticResource IsLastItemConverter}">
  175. <Binding RelativeSource="{RelativeSource Self}" />
  176. <Binding Path="Items.Count" RelativeSource="{RelativeSource AncestorType={x:Type local:StepBar}}" />
  177. </MultiBinding>
  178. </DataTrigger.Binding>
  179. <Setter TargetName="Line" Property="Visibility" Value="Collapsed" />
  180. <Setter Property="HorizontalAlignment" Value="Left" />
  181. </DataTrigger>
  182. <DataTrigger Value="False">
  183. <DataTrigger.Binding>
  184. <MultiBinding Converter="{StaticResource IsLastItemConverter}">
  185. <Binding RelativeSource="{RelativeSource Self}" />
  186. <Binding Path="Items.Count" RelativeSource="{RelativeSource AncestorType={x:Type local:StepBar}}" />
  187. </MultiBinding>
  188. </DataTrigger.Binding>
  189. <Setter TargetName="Line" Property="Visibility" Value="Visible" />
  190. </DataTrigger>
  191. <DataTrigger Value="Less">
  192. <DataTrigger.Binding>
  193. <MultiBinding Converter="{StaticResource IsProgressedConverter}">
  194. <Binding RelativeSource="{RelativeSource Self}" />
  195. <Binding Path="CurrentIndex" RelativeSource="{RelativeSource AncestorType={x:Type local:StepBar}}" />
  196. </MultiBinding>
  197. </DataTrigger.Binding>
  198. <Setter TargetName="Line" Property="BorderBrush" Value="{Binding ActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  199. <Setter TargetName="path" Property="Visibility" Value="Visible" />
  200. <Setter Property="Foreground" Value="{Binding ActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  201. </DataTrigger>
  202. <DataTrigger Value="Equal">
  203. <DataTrigger.Binding>
  204. <MultiBinding Converter="{StaticResource IsProgressedConverter}">
  205. <Binding RelativeSource="{RelativeSource Self}" />
  206. <Binding Path="CurrentIndex" RelativeSource="{RelativeSource AncestorType={x:Type local:StepBar}}" />
  207. </MultiBinding>
  208. </DataTrigger.Binding>
  209. <Setter TargetName="Line" Property="BorderBrush" Value="{Binding UnActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  210. <Setter TargetName="path" Property="Visibility" Value="Visible" />
  211. <Setter Property="Foreground" Value="{Binding ActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  212. </DataTrigger>
  213. <DataTrigger Value="Large">
  214. <DataTrigger.Binding>
  215. <MultiBinding Converter="{StaticResource IsProgressedConverter}">
  216. <Binding RelativeSource="{RelativeSource Self}" />
  217. <Binding Path="CurrentIndex" RelativeSource="{RelativeSource AncestorType={x:Type local:StepBar}}" />
  218. </MultiBinding>
  219. </DataTrigger.Binding>
  220. <Setter TargetName="Line" Property="BorderBrush" Value="{Binding UnActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  221. <Setter TargetName="path" Property="Visibility" Value="Collapsed" />
  222. <Setter Property="Foreground" Value="{Binding UnActivateColor, RelativeSource={RelativeSource AncestorType=local:StepBar}}" />
  223. </DataTrigger>
  224. </ControlTemplate.Triggers>
  225. </ControlTemplate>
  226. </Setter.Value>
  227. </Setter>
  228. </DataTrigger>
  229. </Style.Triggers>
  230. </Style>
  231. <Style TargetType="{x:Type local:StepBar}">
  232. <Setter Property="HorizontalAlignment" Value="Left" />
  233. <Setter Property="Template">
  234. <Setter.Value>
  235. <ControlTemplate TargetType="{x:Type local:StepBar}">
  236. <Border Background="{TemplateBinding Background}">
  237. <ScrollViewer PanningMode="HorizontalOnly" VerticalScrollBarVisibility="Disabled">
  238. <ItemsPresenter />
  239. </ScrollViewer>
  240. </Border>
  241. </ControlTemplate>
  242. </Setter.Value>
  243. </Setter>
  244. <Setter Property="ItemsPanel">
  245. <Setter.Value>
  246. <ItemsPanelTemplate>
  247. <StackPanel IsItemsHost="True" Orientation="Horizontal" />
  248. </ItemsPanelTemplate>
  249. </Setter.Value>
  250. </Setter>
  251. <Style.Triggers>
  252. <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Orientation}" Value="Vertical">
  253. <Setter Property="ItemsPanel">
  254. <Setter.Value>
  255. <ItemsPanelTemplate>
  256. <StackPanel IsItemsHost="True" Orientation="Vertical" />
  257. </ItemsPanelTemplate>
  258. </Setter.Value>
  259. </Setter>
  260. </DataTrigger>
  261. </Style.Triggers>
  262. </Style>
  263. </ResourceDictionary>