You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

343 lines
23 KiB

  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:bpa="clr-namespace:BPA.UIControl">
  4. <ResourceDictionary.MergedDictionaries>
  5. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Resources/Default.xaml" />
  6. </ResourceDictionary.MergedDictionaries>
  7. <Style x:Key="HorizontalStepBarItem" TargetType="{x:Type bpa:StepBarItem}">
  8. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  9. <Setter Property="Focusable" Value="False" />
  10. <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType=bpa:StepBar}}" />
  11. <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=bpa:StepBar}}" />
  12. <Setter Property="CurrentIndex" Value="{Binding CurrentIndex, RelativeSource={RelativeSource AncestorType=bpa:StepBar}}" />
  13. <Setter Property="IconType" Value="{x:Null}" />
  14. <Setter Property="Focusable" Value="False" />
  15. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=bpa:StepBar}}" />
  16. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource AncestorType=bpa:StepBar}}" />
  17. <Setter Property="Template">
  18. <Setter.Value>
  19. <ControlTemplate TargetType="{x:Type bpa:StepBarItem}">
  20. <Grid x:Name="root">
  21. <Grid.RowDefinitions>
  22. <RowDefinition Height="35" />
  23. <RowDefinition Height="Auto" />
  24. <RowDefinition Height="Auto" />
  25. </Grid.RowDefinitions>
  26. <Grid.ColumnDefinitions>
  27. <ColumnDefinition Width="*" />
  28. <ColumnDefinition Width="Auto" />
  29. <ColumnDefinition Width="*" />
  30. </Grid.ColumnDefinitions>
  31. <Rectangle x:Name="leftLine"
  32. Height="2"
  33. Margin="-1 0"
  34. Fill="{TemplateBinding Foreground}" />
  35. <Viewbox Grid.Column="1" Focusable="False">
  36. <Grid>
  37. <bpa:Icon x:Name="icon"
  38. Width="35"
  39. Height="35"
  40. Type="{TemplateBinding IconType}" />
  41. <TextBlock x:Name="indexText"
  42. HorizontalAlignment="Center"
  43. VerticalAlignment="Center"
  44. FontSize="13"
  45. Foreground="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  46. Text="{Binding Index, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  47. </Grid>
  48. </Viewbox>
  49. <Rectangle x:Name="rightLine"
  50. Grid.Column="2"
  51. Height="2"
  52. Margin="-1 0"
  53. Fill="{TemplateBinding Foreground}" />
  54. <ContentPresenter x:Name="contentPresenter"
  55. Grid.Row="1"
  56. Grid.ColumnSpan="3"
  57. Margin="0 6 0 0"
  58. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  59. Focusable="False"
  60. RecognizesAccessKey="True"
  61. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  62. <!-- description -->
  63. <TextBlock x:Name="descriptionText"
  64. Grid.Row="2"
  65. Grid.ColumnSpan="3"
  66. Margin="0 6 0 0"
  67. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  68. Focusable="False"
  69. FontSize="12"
  70. FontWeight="Normal"
  71. Text="{TemplateBinding Description}" />
  72. <VisualStateManager.VisualStateGroups>
  73. <VisualStateGroup x:Name="ViewStates">
  74. <VisualState x:Name="Waiting" />
  75. <VisualState x:Name="Underway" />
  76. <VisualState x:Name="Completed" />
  77. <VisualState x:Name="Finished" />
  78. </VisualStateGroup>
  79. </VisualStateManager.VisualStateGroups>
  80. </Grid>
  81. <ControlTemplate.Triggers>
  82. <DataTrigger Binding="{Binding Text, ElementName=descriptionText, Converter={StaticResource IsNullOrEmptyConverter}}" Value="True">
  83. <Setter TargetName="descriptionText" Property="Visibility" Value="Collapsed" />
  84. </DataTrigger>
  85. <Trigger Property="IsFirst" Value="True">
  86. <Setter TargetName="leftLine" Property="Visibility" Value="Collapsed" />
  87. </Trigger>
  88. <Trigger Property="IsFirst" Value="False">
  89. <Setter TargetName="leftLine" Property="Visibility" Value="Visible" />
  90. </Trigger>
  91. <Trigger Property="IsLast" Value="True">
  92. <Setter TargetName="rightLine" Property="Visibility" Value="Collapsed" />
  93. </Trigger>
  94. <Trigger Property="IsLast" Value="False">
  95. <Setter TargetName="rightLine" Property="Visibility" Value="Visible" />
  96. </Trigger>
  97. <Trigger Property="HorizontalContentAlignment" Value="Left">
  98. <Setter TargetName="contentPresenter" Property="Grid.Column" Value="1" />
  99. <Setter TargetName="contentPresenter" Property="Grid.ColumnSpan" Value="2" />
  100. <Setter TargetName="descriptionText" Property="Grid.Column" Value="1" />
  101. <Setter TargetName="descriptionText" Property="Grid.ColumnSpan" Value="2" />
  102. </Trigger>
  103. <Trigger Property="HorizontalContentAlignment" Value="Right">
  104. <Setter TargetName="contentPresenter" Property="Grid.Column" Value="0" />
  105. <Setter TargetName="contentPresenter" Property="Grid.ColumnSpan" Value="2" />
  106. <Setter TargetName="descriptionText" Property="Grid.Column" Value="0" />
  107. <Setter TargetName="descriptionText" Property="Grid.ColumnSpan" Value="2" />
  108. </Trigger>
  109. <Trigger Property="IsWaiting" Value="True">
  110. <Setter Property="Foreground" Value="{DynamicResource SeconarydText}" />
  111. </Trigger>
  112. <Trigger Property="IsUnderway" Value="True">
  113. <Setter TargetName="rightLine" Property="Fill" Value="{DynamicResource SeconarydText}" />
  114. <Setter TargetName="indexText" Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  115. </Trigger>
  116. <Trigger Property="IsCompleted" Value="True">
  117. <Setter Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Self}}" />
  118. <Setter TargetName="indexText" Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  119. <Setter TargetName="rightLine" Property="Fill" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType=bpa:StepBar}}" />
  120. </Trigger>
  121. <Trigger Property="IsFinished" Value="True">
  122. <Setter TargetName="indexText" Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  123. <Setter Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Self}}" />
  124. </Trigger>
  125. <DataTrigger Binding="{Binding IconType, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource NotNullConverter}}" Value="False">
  126. <Setter TargetName="icon" Property="Type" Value="CheckboxBlankCircleFill" />
  127. </DataTrigger>
  128. <DataTrigger Binding="{Binding IconType, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource NotNullConverter}}" Value="True">
  129. <Setter TargetName="indexText" Property="Visibility" Value="Collapsed" />
  130. </DataTrigger>
  131. <MultiDataTrigger>
  132. <MultiDataTrigger.Conditions>
  133. <Condition Binding="{Binding IconType, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource NotNullConverter}}" Value="False" />
  134. <Condition Binding="{Binding IsCompleted, RelativeSource={RelativeSource Mode=Self}}" Value="True" />
  135. </MultiDataTrigger.Conditions>
  136. <Setter TargetName="indexText" Property="Visibility" Value="Collapsed" />
  137. <Setter TargetName="icon" Property="Type" Value="CheckboxCircleFill" />
  138. </MultiDataTrigger>
  139. <MultiDataTrigger>
  140. <MultiDataTrigger.Conditions>
  141. <Condition Binding="{Binding IconType, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource NotNullConverter}}" Value="False" />
  142. <Condition Binding="{Binding IsFinished, RelativeSource={RelativeSource Mode=Self}}" Value="True" />
  143. </MultiDataTrigger.Conditions>
  144. <Setter TargetName="indexText" Property="Visibility" Value="Collapsed" />
  145. <Setter TargetName="icon" Property="Type" Value="CheckboxCircleFill" />
  146. </MultiDataTrigger>
  147. </ControlTemplate.Triggers>
  148. </ControlTemplate>
  149. </Setter.Value>
  150. </Setter>
  151. </Style>
  152. <Style x:Key="VerticalStepBarItem"
  153. BasedOn="{StaticResource HorizontalStepBarItem}"
  154. TargetType="{x:Type bpa:StepBarItem}">
  155. <Setter Property="Template">
  156. <Setter.Value>
  157. <ControlTemplate TargetType="{x:Type bpa:StepBarItem}">
  158. <Grid>
  159. <Grid.ColumnDefinitions>
  160. <ColumnDefinition Width="35" />
  161. <ColumnDefinition Width="Auto" />
  162. </Grid.ColumnDefinitions>
  163. <Grid.RowDefinitions>
  164. <RowDefinition Height="*" />
  165. <RowDefinition Height="Auto" />
  166. <RowDefinition Height="*" />
  167. </Grid.RowDefinitions>
  168. <Rectangle x:Name="topLine"
  169. Width="2"
  170. Margin="0 -1"
  171. Fill="{TemplateBinding Foreground}" />
  172. <Viewbox Grid.Row="1" Focusable="False">
  173. <Grid>
  174. <bpa:Icon x:Name="icon"
  175. Width="35"
  176. Height="35"
  177. Type="{TemplateBinding IconType}" />
  178. <TextBlock x:Name="indexText"
  179. HorizontalAlignment="Center"
  180. VerticalAlignment="Center"
  181. FontSize="13"
  182. Foreground="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  183. Text="{Binding Index, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  184. </Grid>
  185. </Viewbox>
  186. <Rectangle x:Name="bottomLine"
  187. Grid.Row="2"
  188. Width="2"
  189. Margin="0 -1"
  190. Fill="{TemplateBinding Foreground}" />
  191. <StackPanel x:Name="contentPanel"
  192. Grid.Row="1"
  193. Grid.RowSpan="2"
  194. Grid.Column="1"
  195. Margin="6 0 0 0"
  196. VerticalAlignment="Top">
  197. <ContentPresenter x:Name="contentPresenter"
  198. Focusable="False"
  199. RecognizesAccessKey="True"
  200. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  201. <!-- description -->
  202. <TextBlock x:Name="descriptionText"
  203. Margin="0 6 0 0"
  204. Focusable="False"
  205. FontSize="12"
  206. FontWeight="Normal"
  207. Text="{TemplateBinding Description}" />
  208. </StackPanel>
  209. <VisualStateManager.VisualStateGroups>
  210. <VisualStateGroup x:Name="ViewStates">
  211. <VisualState x:Name="Waiting" />
  212. <VisualState x:Name="Underway" />
  213. <VisualState x:Name="Completed" />
  214. <VisualState x:Name="Finished" />
  215. </VisualStateGroup>
  216. </VisualStateManager.VisualStateGroups>
  217. </Grid>
  218. <ControlTemplate.Triggers>
  219. <DataTrigger Binding="{Binding Text, ElementName=descriptionText, Converter={StaticResource IsNullOrEmptyConverter}}" Value="True">
  220. <Setter TargetName="descriptionText" Property="Visibility" Value="Collapsed" />
  221. </DataTrigger>
  222. <Trigger Property="IsFirst" Value="True">
  223. <Setter TargetName="topLine" Property="Visibility" Value="Collapsed" />
  224. </Trigger>
  225. <Trigger Property="IsFirst" Value="False">
  226. <Setter TargetName="topLine" Property="Visibility" Value="Visible" />
  227. </Trigger>
  228. <Trigger Property="IsLast" Value="True">
  229. <Setter TargetName="bottomLine" Property="Visibility" Value="Collapsed" />
  230. </Trigger>
  231. <Trigger Property="IsLast" Value="False">
  232. <Setter TargetName="bottomLine" Property="Visibility" Value="Visible" />
  233. </Trigger>
  234. <Trigger Property="VerticalContentAlignment" Value="Top">
  235. <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
  236. <Setter TargetName="contentPanel" Property="Grid.RowSpan" Value="3" />
  237. </Trigger>
  238. <Trigger Property="VerticalContentAlignment" Value="Bottom">
  239. <Setter TargetName="contentPanel" Property="Grid.Row" Value="2" />
  240. <Setter TargetName="contentPanel" Property="Grid.RowSpan" Value="1" />
  241. </Trigger>
  242. <Trigger Property="IsWaiting" Value="True">
  243. <Setter Property="Foreground" Value="{DynamicResource SeconarydText}" />
  244. </Trigger>
  245. <Trigger Property="IsUnderway" Value="True">
  246. <Setter TargetName="bottomLine" Property="Fill" Value="{DynamicResource SeconarydText}" />
  247. <Setter TargetName="indexText" Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  248. </Trigger>
  249. <Trigger Property="IsCompleted" Value="True">
  250. <Setter Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Self}}" />
  251. <Setter TargetName="indexText" Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  252. <Setter TargetName="bottomLine" Property="Fill" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType=bpa:StepBar}}" />
  253. </Trigger>
  254. <Trigger Property="IsFinished" Value="True">
  255. <Setter TargetName="indexText" Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  256. <Setter Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Self}}" />
  257. </Trigger>
  258. <DataTrigger Binding="{Binding IconType, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource NotNullConverter}}" Value="False">
  259. <Setter TargetName="icon" Property="Type" Value="CheckboxBlankCircleFill" />
  260. </DataTrigger>
  261. <DataTrigger Binding="{Binding IconType, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource NotNullConverter}}" Value="True">
  262. <Setter TargetName="indexText" Property="Visibility" Value="Collapsed" />
  263. </DataTrigger>
  264. <MultiDataTrigger>
  265. <MultiDataTrigger.Conditions>
  266. <Condition Binding="{Binding IconType, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource NotNullConverter}}" Value="False" />
  267. <Condition Binding="{Binding IsCompleted, RelativeSource={RelativeSource Mode=Self}}" Value="True" />
  268. </MultiDataTrigger.Conditions>
  269. <Setter TargetName="indexText" Property="Visibility" Value="Collapsed" />
  270. <Setter TargetName="icon" Property="Type" Value="CheckboxCircleFill" />
  271. </MultiDataTrigger>
  272. <MultiDataTrigger>
  273. <MultiDataTrigger.Conditions>
  274. <Condition Binding="{Binding IconType, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource NotNullConverter}}" Value="False" />
  275. <Condition Binding="{Binding IsFinished, RelativeSource={RelativeSource Mode=Self}}" Value="True" />
  276. </MultiDataTrigger.Conditions>
  277. <Setter TargetName="indexText" Property="Visibility" Value="Collapsed" />
  278. <Setter TargetName="icon" Property="Type" Value="CheckboxCircleFill" />
  279. </MultiDataTrigger>
  280. </ControlTemplate.Triggers>
  281. </ControlTemplate>
  282. </Setter.Value>
  283. </Setter>
  284. </Style>
  285. <Style x:Key="RubyerStepBar" TargetType="{x:Type bpa:StepBar}">
  286. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  287. <Setter Property="SnapsToDevicePixels" Value="True" />
  288. <Setter Property="VerticalContentAlignment" Value="Center" />
  289. <Setter Property="HorizontalContentAlignment" Value="Center" />
  290. <Setter Property="ItemContainerStyle" Value="{StaticResource HorizontalStepBarItem}" />
  291. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Primary}" />
  292. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource DefaultBackground}" />
  293. <Setter Property="FontSize" Value="16" />
  294. <Setter Property="ItemsPanel">
  295. <Setter.Value>
  296. <ItemsPanelTemplate>
  297. <UniformGrid Rows="1" />
  298. </ItemsPanelTemplate>
  299. </Setter.Value>
  300. </Setter>
  301. <Setter Property="Template">
  302. <Setter.Value>
  303. <ControlTemplate TargetType="{x:Type bpa:StepBar}">
  304. <Border Background="{TemplateBinding Background}"
  305. BorderBrush="{TemplateBinding BorderBrush}"
  306. BorderThickness="{TemplateBinding BorderThickness}">
  307. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  308. </Border>
  309. <ControlTemplate.Triggers>
  310. <Trigger Property="Orientation" Value="Vertical">
  311. <Setter Property="ItemContainerStyle" Value="{StaticResource VerticalStepBarItem}" />
  312. <Setter Property="ItemsPanel">
  313. <Setter.Value>
  314. <ItemsPanelTemplate>
  315. <UniformGrid Columns="1" />
  316. </ItemsPanelTemplate>
  317. </Setter.Value>
  318. </Setter>
  319. </Trigger>
  320. </ControlTemplate.Triggers>
  321. </ControlTemplate>
  322. </Setter.Value>
  323. </Setter>
  324. </Style>
  325. </ResourceDictionary>