ProgressBar.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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. xmlns:system="clr-namespace:System;assembly=mscorlib">
  5. <Style BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="ProgressBar">
  6. <Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
  7. </Style>
  8. <Style x:Key="ProgressBarSuccess" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="ProgressBar">
  9. <Setter Property="Foreground" Value="{DynamicResource SuccessBrush}"/>
  10. </Style>
  11. <Style x:Key="ProgressBarInfo" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="ProgressBar">
  12. <Setter Property="Foreground" Value="{DynamicResource InfoBrush}"/>
  13. </Style>
  14. <Style x:Key="ProgressBarWarning" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="ProgressBar">
  15. <Setter Property="Foreground" Value="{DynamicResource WarningBrush}"/>
  16. </Style>
  17. <Style x:Key="ProgressBarDanger" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="ProgressBar">
  18. <Setter Property="Foreground" Value="{DynamicResource DangerBrush}"/>
  19. </Style>
  20. <Style x:Key="ProgressBarPrimaryStripe" BasedOn="{StaticResource ProgressBarStripeBaseStyle}" TargetType="ProgressBar">
  21. <Setter Property="Foreground">
  22. <Setter.Value>
  23. <DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
  24. <DrawingBrush.Transform>
  25. <TransformGroup>
  26. <RotateTransform Angle="20"/>
  27. <TranslateTransform x:Name="MyTransform" X="0"/>
  28. </TransformGroup>
  29. </DrawingBrush.Transform>
  30. <DrawingBrush.Drawing>
  31. <GeometryDrawing>
  32. <GeometryDrawing.Brush>
  33. <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
  34. <GradientStop Color="{DynamicResource DarkPrimaryColor}" Offset="0"/>
  35. <GradientStop Color="{DynamicResource DarkPrimaryColor}" Offset="0.5"/>
  36. <GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
  37. <GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
  38. </LinearGradientBrush>
  39. </GeometryDrawing.Brush>
  40. <GeometryDrawing.Geometry>
  41. <RectangleGeometry Rect="0,0,20,32"/>
  42. </GeometryDrawing.Geometry>
  43. </GeometryDrawing>
  44. </DrawingBrush.Drawing>
  45. </DrawingBrush>
  46. </Setter.Value>
  47. </Setter>
  48. </Style>
  49. <Style x:Key="ProgressBarSuccessStripe" BasedOn="{StaticResource ProgressBarStripeBaseStyle}" TargetType="ProgressBar">
  50. <Setter Property="Foreground">
  51. <Setter.Value>
  52. <DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
  53. <DrawingBrush.Transform>
  54. <TransformGroup>
  55. <RotateTransform Angle="20"/>
  56. <TranslateTransform x:Name="MyTransform" X="0"/>
  57. </TransformGroup>
  58. </DrawingBrush.Transform>
  59. <DrawingBrush.Drawing>
  60. <GeometryDrawing>
  61. <GeometryDrawing.Brush>
  62. <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
  63. <GradientStop Color="{DynamicResource DarkSuccessColor}" Offset="0"/>
  64. <GradientStop Color="{DynamicResource DarkSuccessColor}" Offset="0.5"/>
  65. <GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
  66. <GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
  67. </LinearGradientBrush>
  68. </GeometryDrawing.Brush>
  69. <GeometryDrawing.Geometry>
  70. <RectangleGeometry Rect="0,0,20,32"/>
  71. </GeometryDrawing.Geometry>
  72. </GeometryDrawing>
  73. </DrawingBrush.Drawing>
  74. </DrawingBrush>
  75. </Setter.Value>
  76. </Setter>
  77. </Style>
  78. <Style x:Key="ProgressBarInfoStripe" BasedOn="{StaticResource ProgressBarStripeBaseStyle}" TargetType="ProgressBar">
  79. <Setter Property="Foreground">
  80. <Setter.Value>
  81. <DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
  82. <DrawingBrush.Transform>
  83. <TransformGroup>
  84. <RotateTransform Angle="20"/>
  85. <TranslateTransform x:Name="MyTransform" X="0"/>
  86. </TransformGroup>
  87. </DrawingBrush.Transform>
  88. <DrawingBrush.Drawing>
  89. <GeometryDrawing>
  90. <GeometryDrawing.Brush>
  91. <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
  92. <GradientStop Color="{DynamicResource DarkInfoColor}" Offset="0"/>
  93. <GradientStop Color="{DynamicResource DarkInfoColor}" Offset="0.5"/>
  94. <GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
  95. <GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
  96. </LinearGradientBrush>
  97. </GeometryDrawing.Brush>
  98. <GeometryDrawing.Geometry>
  99. <RectangleGeometry Rect="0,0,20,32"/>
  100. </GeometryDrawing.Geometry>
  101. </GeometryDrawing>
  102. </DrawingBrush.Drawing>
  103. </DrawingBrush>
  104. </Setter.Value>
  105. </Setter>
  106. </Style>
  107. <Style x:Key="ProgressBarWarningStripe" BasedOn="{StaticResource ProgressBarStripeBaseStyle}" TargetType="ProgressBar">
  108. <Setter Property="Foreground">
  109. <Setter.Value>
  110. <DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
  111. <DrawingBrush.Transform>
  112. <TransformGroup>
  113. <RotateTransform Angle="20"/>
  114. <TranslateTransform x:Name="MyTransform" X="0"/>
  115. </TransformGroup>
  116. </DrawingBrush.Transform>
  117. <DrawingBrush.Drawing>
  118. <GeometryDrawing>
  119. <GeometryDrawing.Brush>
  120. <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
  121. <GradientStop Color="{DynamicResource DarkWarningColor}" Offset="0"/>
  122. <GradientStop Color="{DynamicResource DarkWarningColor}" Offset="0.5"/>
  123. <GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
  124. <GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
  125. </LinearGradientBrush>
  126. </GeometryDrawing.Brush>
  127. <GeometryDrawing.Geometry>
  128. <RectangleGeometry Rect="0,0,20,32"/>
  129. </GeometryDrawing.Geometry>
  130. </GeometryDrawing>
  131. </DrawingBrush.Drawing>
  132. </DrawingBrush>
  133. </Setter.Value>
  134. </Setter>
  135. </Style>
  136. <Style x:Key="ProgressBarDangerStripe" BasedOn="{StaticResource ProgressBarStripeBaseStyle}" TargetType="ProgressBar">
  137. <Setter Property="Foreground">
  138. <Setter.Value>
  139. <DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
  140. <DrawingBrush.Transform>
  141. <TransformGroup>
  142. <RotateTransform Angle="20"/>
  143. <TranslateTransform x:Name="MyTransform" X="0"/>
  144. </TransformGroup>
  145. </DrawingBrush.Transform>
  146. <DrawingBrush.Drawing>
  147. <GeometryDrawing>
  148. <GeometryDrawing.Brush>
  149. <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
  150. <GradientStop Color="{DynamicResource DarkDangerColor}" Offset="0"/>
  151. <GradientStop Color="{DynamicResource DarkDangerColor}" Offset="0.5"/>
  152. <GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
  153. <GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
  154. </LinearGradientBrush>
  155. </GeometryDrawing.Brush>
  156. <GeometryDrawing.Geometry>
  157. <RectangleGeometry Rect="0,0,20,32"/>
  158. </GeometryDrawing.Geometry>
  159. </GeometryDrawing>
  160. </DrawingBrush.Drawing>
  161. </DrawingBrush>
  162. </Setter.Value>
  163. </Setter>
  164. </Style>
  165. <Style BasedOn="{StaticResource ProgressBarCircleBaseStyle}" TargetType="hc:CircleProgressBar">
  166. <Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
  167. </Style>
  168. <Style x:Key="ProgressBarSuccessCircle" BasedOn="{StaticResource ProgressBarCircleBaseStyle}" TargetType="hc:CircleProgressBar">
  169. <Setter Property="Foreground" Value="{DynamicResource SuccessBrush}"/>
  170. </Style>
  171. <Style x:Key="ProgressBarInfoCircle" BasedOn="{StaticResource ProgressBarCircleBaseStyle}" TargetType="hc:CircleProgressBar">
  172. <Setter Property="Foreground" Value="{DynamicResource InfoBrush}"/>
  173. </Style>
  174. <Style x:Key="ProgressBarWarningCircle" BasedOn="{StaticResource ProgressBarCircleBaseStyle}" TargetType="hc:CircleProgressBar">
  175. <Setter Property="Foreground" Value="{DynamicResource WarningBrush}"/>
  176. </Style>
  177. <Style x:Key="ProgressBarDangerCircle" BasedOn="{StaticResource ProgressBarCircleBaseStyle}" TargetType="hc:CircleProgressBar">
  178. <Setter Property="Foreground" Value="{DynamicResource DangerBrush}"/>
  179. </Style>
  180. <Style BasedOn="{StaticResource ProgressBarWaveBaseStyle}" TargetType="hc:WaveProgressBar">
  181. <Setter Property="WaveFill" Value="{DynamicResource DarkPrimaryBrush}"/>
  182. </Style>
  183. <Style x:Key="ProgressBarSuccessWave" BasedOn="{StaticResource ProgressBarWaveBaseStyle}" TargetType="hc:WaveProgressBar">
  184. <Setter Property="WaveFill" Value="{DynamicResource DarkSuccessBrush}"/>
  185. </Style>
  186. <Style x:Key="ProgressBarInfoWave" BasedOn="{StaticResource ProgressBarWaveBaseStyle}" TargetType="hc:WaveProgressBar">
  187. <Setter Property="WaveFill" Value="{DynamicResource DarkInfoBrush}"/>
  188. </Style>
  189. <Style x:Key="ProgressBarWarningWave" BasedOn="{StaticResource ProgressBarWaveBaseStyle}" TargetType="hc:WaveProgressBar">
  190. <Setter Property="WaveFill" Value="{DynamicResource DarkWarningBrush}"/>
  191. </Style>
  192. <Style x:Key="ProgressBarDangerWave" BasedOn="{StaticResource ProgressBarWaveBaseStyle}" TargetType="hc:WaveProgressBar">
  193. <Setter Property="WaveFill" Value="{DynamicResource DarkDangerBrush}"/>
  194. </Style>
  195. <Style x:Key="ProgressBarFlat" TargetType="ProgressBar">
  196. <Setter Property="Height" Value="4"/>
  197. <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
  198. <Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
  199. <Setter Property="Template">
  200. <Setter.Value>
  201. <ControlTemplate TargetType="ProgressBar">
  202. <ControlTemplate.Resources>
  203. <Storyboard x:Key="IsIndeterminate" RepeatBehavior="Forever">
  204. <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Animation">
  205. <EasingDoubleKeyFrame KeyTime="0" Value="0.25"/>
  206. <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25"/>
  207. <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/>
  208. </DoubleAnimationUsingKeyFrames>
  209. <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="Animation">
  210. <EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5"/>
  211. <EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/>
  212. <EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5"/>
  213. </PointAnimationUsingKeyFrames>
  214. </Storyboard>
  215. </ControlTemplate.Resources>
  216. <hc:SimplePanel x:Name="TemplateRoot" SnapsToDevicePixels="true" ClipToBounds="True">
  217. <Rectangle x:Name="PART_Track" Fill="{TemplateBinding Background}" StrokeThickness="0" Stroke="{TemplateBinding BorderBrush}"/>
  218. <Decorator x:Name="PART_Indicator" HorizontalAlignment="Left">
  219. <Rectangle x:Name="Indicator" Fill="{TemplateBinding Foreground}"/>
  220. </Decorator>
  221. <Rectangle x:Name="Animation" Visibility="Collapsed" Fill="{TemplateBinding Foreground}" RenderTransformOrigin="0.5,0.5">
  222. <Rectangle.RenderTransform>
  223. <TransformGroup>
  224. <ScaleTransform/>
  225. </TransformGroup>
  226. </Rectangle.RenderTransform>
  227. </Rectangle>
  228. </hc:SimplePanel>
  229. <ControlTemplate.Triggers>
  230. <Trigger Property="IsIndeterminate" Value="true">
  231. <Trigger.EnterActions>
  232. <BeginStoryboard Storyboard="{StaticResource IsIndeterminate}"/>
  233. </Trigger.EnterActions>
  234. <Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
  235. <Setter Property="Visibility" TargetName="Animation" Value="Visible"/>
  236. </Trigger>
  237. <Trigger Property="Orientation" Value="Vertical">
  238. <Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
  239. <Setter Property="LayoutTransform" TargetName="TemplateRoot">
  240. <Setter.Value>
  241. <RotateTransform Angle="-90"/>
  242. </Setter.Value>
  243. </Setter>
  244. </Trigger>
  245. </ControlTemplate.Triggers>
  246. </ControlTemplate>
  247. </Setter.Value>
  248. </Setter>
  249. </Style>
  250. </ResourceDictionary>