ProgressBar.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <ResourceDictionary.MergedDictionaries>
  3. <ResourceDictionary Source="BaseStyle.xaml" />
  4. </ResourceDictionary.MergedDictionaries>
  5. <!-- 进度条 4812 -->
  6. <LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill" StartPoint="0,0" EndPoint="1,0">
  7. <GradientStop Offset="0" Color="#00FFFFFF" />
  8. <GradientStop Offset="0.4" Color="#60FFFFFF" />
  9. <GradientStop Offset="0.6" Color="#60FFFFFF" />
  10. <GradientStop Offset="1" Color="#00FFFFFF" />
  11. </LinearGradientBrush>
  12. <Style x:Key="ProgressBarBaseStyle" TargetType="{x:Type ProgressBar}">
  13. <Setter Property="Height" Value="20" />
  14. <Setter Property="Background" Value="#f5f5f5" />
  15. <Setter Property="BorderBrush" Value="#19000000" />
  16. <Setter Property="BorderThickness" Value="1,1,1,0" />
  17. <Setter Property="Template">
  18. <Setter.Value>
  19. <ControlTemplate TargetType="{x:Type ProgressBar}">
  20. <Grid>
  21. <Border
  22. x:Name="TemplateRoot"
  23. Background="{TemplateBinding Background}"
  24. BorderBrush="{TemplateBinding BorderBrush}"
  25. BorderThickness="{TemplateBinding BorderThickness}"
  26. CornerRadius="4">
  27. <Border.Effect>
  28. <BlurEffect Radius="2" />
  29. </Border.Effect>
  30. </Border>
  31. <Grid Margin="{TemplateBinding BorderThickness}">
  32. <Rectangle x:Name="PART_Track" />
  33. <Grid HorizontalAlignment="Left">
  34. <Decorator
  35. x:Name="PART_Indicator"
  36. Margin="0,-1,0,0"
  37. HorizontalAlignment="Left">
  38. <Border
  39. x:Name="Animation"
  40. Background="{TemplateBinding Foreground}"
  41. ClipToBounds="true"
  42. CornerRadius="4">
  43. <Rectangle
  44. x:Name="PART_GlowRect"
  45. Width="100"
  46. Margin="-100,0,0,0"
  47. HorizontalAlignment="Left"
  48. Fill="{StaticResource ProgressBarIndicatorAnimatedFill}" />
  49. </Border>
  50. </Decorator>
  51. <StackPanel
  52. HorizontalAlignment="Center"
  53. VerticalAlignment="Center"
  54. Orientation="Horizontal">
  55. <Label
  56. Content="{TemplateBinding Value}"
  57. FontSize="{DynamicResource SmallFontSize}"
  58. Foreground="#fff" />
  59. <Label
  60. Content="%"
  61. FontSize="{DynamicResource SmallFontSize}"
  62. Foreground="#fff" />
  63. </StackPanel>
  64. </Grid>
  65. </Grid>
  66. </Grid>
  67. <ControlTemplate.Triggers>
  68. <Trigger Property="Orientation" Value="Vertical">
  69. <Setter TargetName="TemplateRoot" Property="LayoutTransform">
  70. <Setter.Value>
  71. <RotateTransform Angle="-90" />
  72. </Setter.Value>
  73. </Setter>
  74. </Trigger>
  75. </ControlTemplate.Triggers>
  76. </ControlTemplate>
  77. </Setter.Value>
  78. </Setter>
  79. </Style>
  80. <Style
  81. x:Key="progress-bar"
  82. BasedOn="{StaticResource ProgressBarBaseStyle}"
  83. TargetType="{x:Type ProgressBar}">
  84. <Setter Property="Foreground" Value="{DynamicResource Background-Primary1}" />
  85. </Style>
  86. <Style
  87. x:Key="progress-bar-success"
  88. BasedOn="{StaticResource ProgressBarBaseStyle}"
  89. TargetType="{x:Type ProgressBar}">
  90. <Setter Property="Foreground" Value="{DynamicResource Background-Success1}" />
  91. </Style>
  92. <Style
  93. x:Key="progress-bar-info"
  94. BasedOn="{StaticResource ProgressBarBaseStyle}"
  95. TargetType="{x:Type ProgressBar}">
  96. <Setter Property="Foreground" Value="{DynamicResource Background-Info1}" />
  97. </Style>
  98. <Style
  99. x:Key="progress-bar-warning"
  100. BasedOn="{StaticResource ProgressBarBaseStyle}"
  101. TargetType="{x:Type ProgressBar}">
  102. <Setter Property="Foreground" Value="{DynamicResource Background-Warning1}" />
  103. </Style>
  104. <Style
  105. x:Key="progress-bar-danger"
  106. BasedOn="{StaticResource ProgressBarBaseStyle}"
  107. TargetType="{x:Type ProgressBar}">
  108. <Setter Property="Foreground" Value="{DynamicResource Background-Danger1}" />
  109. </Style>
  110. <Style x:Key="MicAensitivityProgressBarStyle" TargetType="{x:Type ProgressBar}">
  111. <Setter Property="Template">
  112. <Setter.Value>
  113. <ControlTemplate TargetType="{x:Type ProgressBar}">
  114. <Grid Width="{TemplateBinding Width}">
  115. <Border x:Name="PART_Track" Background="Transparent">
  116. <ItemsControl>
  117. <ItemsControl.Items>
  118. <Border
  119. Width="4"
  120. Height="30"
  121. Margin="1"
  122. Background="#FFC4C4C4" />
  123. <Border
  124. Width="4"
  125. Height="30"
  126. Margin="1"
  127. Background="#FFC4C4C4" />
  128. <Border
  129. Width="4"
  130. Height="30"
  131. Margin="1"
  132. Background="#FFC4C4C4" />
  133. <Border
  134. Width="4"
  135. Height="30"
  136. Margin="1"
  137. Background="#FFC4C4C4" />
  138. <Border
  139. Width="4"
  140. Height="30"
  141. Margin="1"
  142. Background="#FFC4C4C4" />
  143. <Border
  144. Width="4"
  145. Height="30"
  146. Margin="1"
  147. Background="#FFC4C4C4" />
  148. <Border
  149. Width="4"
  150. Height="30"
  151. Margin="1"
  152. Background="#FFC4C4C4" />
  153. <Border
  154. Width="4"
  155. Height="30"
  156. Margin="1"
  157. Background="#FFC4C4C4" />
  158. <Border
  159. Width="4"
  160. Height="30"
  161. Margin="1"
  162. Background="#FFC4C4C4" />
  163. <Border
  164. Width="4"
  165. Height="30"
  166. Margin="1"
  167. Background="#FFC4C4C4" />
  168. <Border
  169. Width="4"
  170. Height="30"
  171. Margin="1"
  172. Background="#FFC4C4C4" />
  173. <Border
  174. Width="4"
  175. Height="30"
  176. Margin="1"
  177. Background="#FFC4C4C4" />
  178. <Border
  179. Width="4"
  180. Height="30"
  181. Margin="1"
  182. Background="#FFC4C4C4" />
  183. <Border
  184. Width="4"
  185. Height="30"
  186. Margin="1"
  187. Background="#FFC4C4C4" />
  188. <Border
  189. Width="4"
  190. Height="30"
  191. Margin="1"
  192. Background="#FFC4C4C4" />
  193. <Border
  194. Width="4"
  195. Height="30"
  196. Margin="1"
  197. Background="#FFC4C4C4" />
  198. <Border
  199. Width="4"
  200. Height="30"
  201. Margin="1"
  202. Background="#FFC4C4C4" />
  203. <Border
  204. Width="4"
  205. Height="30"
  206. Margin="1"
  207. Background="#FFC4C4C4" />
  208. <Border
  209. Width="4"
  210. Height="30"
  211. Margin="1"
  212. Background="#FFC4C4C4" />
  213. <Border
  214. Width="4"
  215. Height="30"
  216. Margin="1"
  217. Background="#FFC4C4C4" />
  218. </ItemsControl.Items>
  219. <ItemsControl.ItemsPanel>
  220. <ItemsPanelTemplate>
  221. <StackPanel Orientation="Horizontal" />
  222. </ItemsPanelTemplate>
  223. </ItemsControl.ItemsPanel>
  224. </ItemsControl>
  225. </Border>
  226. <Border
  227. x:Name="PART_Indicator"
  228. Margin="0,-1,0,1"
  229. HorizontalAlignment="Left">
  230. <ItemsControl>
  231. <ItemsControl.Items>
  232. <Border
  233. Width="4"
  234. Height="30"
  235. Margin="1"
  236. Background="#31b0d5" />
  237. <Border
  238. Width="4"
  239. Height="30"
  240. Margin="1"
  241. Background="#31b0d5" />
  242. <Border
  243. Width="4"
  244. Height="30"
  245. Margin="1"
  246. Background="#31b0d5" />
  247. <Border
  248. Width="4"
  249. Height="30"
  250. Margin="1"
  251. Background="#31b0d5" />
  252. <Border
  253. Width="4"
  254. Height="30"
  255. Margin="1"
  256. Background="#31b0d5" />
  257. <Border
  258. Width="4"
  259. Height="30"
  260. Margin="1"
  261. Background="#31b0d5" />
  262. <Border
  263. Width="4"
  264. Height="30"
  265. Margin="1"
  266. Background="#31b0d5" />
  267. <Border
  268. Width="4"
  269. Height="30"
  270. Margin="1"
  271. Background="#31b0d5" />
  272. <Border
  273. Width="4"
  274. Height="30"
  275. Margin="1"
  276. Background="#31b0d5" />
  277. <Border
  278. Width="4"
  279. Height="30"
  280. Margin="1"
  281. Background="#31b0d5" />
  282. <Border
  283. Width="4"
  284. Height="30"
  285. Margin="1"
  286. Background="#31b0d5" />
  287. <Border
  288. Width="4"
  289. Height="30"
  290. Margin="1"
  291. Background="#31b0d5" />
  292. <Border
  293. Width="4"
  294. Height="30"
  295. Margin="1"
  296. Background="#31b0d5" />
  297. <Border
  298. Width="4"
  299. Height="30"
  300. Margin="1"
  301. Background="#31b0d5" />
  302. <Border
  303. Width="4"
  304. Height="30"
  305. Margin="1"
  306. Background="#31b0d5" />
  307. <Border
  308. Width="4"
  309. Height="30"
  310. Margin="1"
  311. Background="#31b0d5" />
  312. <Border
  313. Width="4"
  314. Height="30"
  315. Margin="1"
  316. Background="#31b0d5" />
  317. <Border
  318. Width="4"
  319. Height="30"
  320. Margin="1"
  321. Background="#31b0d5" />
  322. <Border
  323. Width="4"
  324. Height="30"
  325. Margin="1"
  326. Background="#31b0d5" />
  327. <Border
  328. Width="4"
  329. Height="30"
  330. Margin="1"
  331. Background="#31b0d5" />
  332. </ItemsControl.Items>
  333. <ItemsControl.ItemsPanel>
  334. <ItemsPanelTemplate>
  335. <StackPanel Orientation="Horizontal" />
  336. </ItemsPanelTemplate>
  337. </ItemsControl.ItemsPanel>
  338. </ItemsControl>
  339. </Border>
  340. </Grid>
  341. </ControlTemplate>
  342. </Setter.Value>
  343. </Setter>
  344. </Style>
  345. </ResourceDictionary>