ProgressBarStyle.xaml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <LinearGradientBrush x:Key="ProgressBarBackground" StartPoint="0.5,0" EndPoint="0.5,1">
  3. <GradientStop Color="#FFE3E8EB" />
  4. <GradientStop Offset="1" Color="White" />
  5. </LinearGradientBrush>
  6. <LinearGradientBrush x:Key="ProgressBarForeground" StartPoint="0.5,0" EndPoint="0.5,1">
  7. <GradientStop Offset="0" Color="#FFFDA956" />
  8. <GradientStop Offset="1" Color="#FFFDA956" />
  9. <GradientStop Offset="0.5" Color="#FFFF7D00" />
  10. </LinearGradientBrush>
  11. <LinearGradientBrush x:Key="ProgressBarBorderBrush" StartPoint="0,0" EndPoint="0,1">
  12. <GradientStop Offset="0.05" Color="#5794BF" />
  13. <GradientStop Offset="0.07" Color="#B7D5EA" />
  14. <GradientStop Offset="1" Color="#C7E2F1" />
  15. </LinearGradientBrush>
  16. <LinearGradientBrush x:Key="ProgressBarGlassyHighlight" StartPoint="0,0" EndPoint="0,1">
  17. <GradientStop Offset="0.5385" Color="#50FFFFFF" />
  18. <GradientStop Offset="0.5385" Color="#00FFFFFF" />
  19. </LinearGradientBrush>
  20. <LinearGradientBrush x:Key="ProgressBarTopHighlight" StartPoint="0,0" EndPoint="0,1">
  21. <GradientStop Offset="0.05" Color="#80FFFFFF" />
  22. <GradientStop Offset="0.25" Color="#00FFFFFF" />
  23. </LinearGradientBrush>
  24. <LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill" StartPoint="0,0" EndPoint="1,0">
  25. <GradientStop Offset="0" Color="#00FFFFFF" />
  26. <GradientStop Offset="0.4" Color="#60FFFFFF" />
  27. <GradientStop Offset="0.6" Color="#60FFFFFF" />
  28. <GradientStop Offset="1" Color="#00FFFFFF" />
  29. </LinearGradientBrush>
  30. <RadialGradientBrush x:Key="ProgressBarIndicatorLightingEffectLeft" RadiusX="1" RadiusY="1" RelativeTransform="1,0,0,1,0.5,0.5">
  31. <GradientStop Offset="0" Color="#60FFFFC4" />
  32. <GradientStop Offset="1" Color="#00FFFFC4" />
  33. </RadialGradientBrush>
  34. <LinearGradientBrush x:Key="ProgressBarIndicatorLightingEffect" StartPoint="0,1" EndPoint="0,0">
  35. <GradientStop Offset="0" Color="#60FFFFC4" />
  36. <GradientStop Offset="1" Color="#00FFFFC4" />
  37. </LinearGradientBrush>
  38. <RadialGradientBrush x:Key="ProgressBarIndicatorLightingEffectRight" RadiusX="1" RadiusY="1" RelativeTransform="1,0,0,1,-0.5,0.5">
  39. <GradientStop Offset="0" Color="#60FFFFC4" />
  40. <GradientStop Offset="1" Color="#00FFFFC4" />
  41. </RadialGradientBrush>
  42. <LinearGradientBrush x:Key="ProgressBarIndicatorGlassyHighlight" StartPoint="0,0" EndPoint="0,1">
  43. <GradientStop Offset="0.5385" Color="#90FFFFFF" />
  44. <GradientStop Offset="0.5385" Color="#00FFFFFF" />
  45. </LinearGradientBrush>
  46. <Style TargetType="{x:Type ProgressBar}">
  47. <Setter Property="Foreground" Value="{StaticResource ProgressBarForeground}" />
  48. <Setter Property="Background" Value="{StaticResource ProgressBarBackground}" />
  49. <Setter Property="BorderBrush" Value="{StaticResource ProgressBarBorderBrush}" />
  50. <Setter Property="BorderThickness" Value="1" />
  51. <Setter Property="Template">
  52. <Setter.Value>
  53. <ControlTemplate TargetType="{x:Type ProgressBar}">
  54. <Grid x:Name="TemplateRoot" SnapsToDevicePixels="true">
  55. <Rectangle RadiusX="1" RadiusY="1" />
  56. <Border Margin="1"
  57. Background="{StaticResource ProgressBarGlassyHighlight}"
  58. CornerRadius="1" />
  59. <Border Margin="1"
  60. Background="{StaticResource ProgressBarTopHighlight}"
  61. BorderBrush="#80FFFFFF"
  62. BorderThickness="1,0,1,1" />
  63. <Rectangle x:Name="PART_Track" Margin="1" />
  64. <Decorator x:Name="PART_Indicator"
  65. Margin="1"
  66. HorizontalAlignment="Left">
  67. <Grid x:Name="Foreground">
  68. <Rectangle x:Name="Indicator" Fill="{TemplateBinding Foreground}" />
  69. <Grid x:Name="Animation" ClipToBounds="true">
  70. <Rectangle x:Name="PART_GlowRect"
  71. Width="100"
  72. Margin="-100,0,0,0"
  73. HorizontalAlignment="Left"
  74. Fill="{StaticResource ProgressBarIndicatorAnimatedFill}" />
  75. </Grid>
  76. <Grid x:Name="Overlay">
  77. <Grid.ColumnDefinitions>
  78. <ColumnDefinition MaxWidth="15" />
  79. <ColumnDefinition Width="0.1*" />
  80. <ColumnDefinition MaxWidth="15" />
  81. </Grid.ColumnDefinitions>
  82. <Grid.RowDefinitions>
  83. <RowDefinition />
  84. <RowDefinition />
  85. </Grid.RowDefinitions>
  86. <Rectangle x:Name="LeftDark"
  87. Grid.RowSpan="2"
  88. Margin="1,1,0,1"
  89. RadiusX="1"
  90. RadiusY="1" />
  91. <Rectangle x:Name="RightDark"
  92. Grid.Row="0"
  93. Grid.RowSpan="2"
  94. Grid.Column="2"
  95. Margin="0,1,1,1"
  96. RadiusX="1"
  97. RadiusY="1" />
  98. <Rectangle x:Name="LeftLight"
  99. Grid.Row="2"
  100. Grid.Column="0"
  101. Fill="{StaticResource ProgressBarIndicatorLightingEffectLeft}" />
  102. <Rectangle x:Name="CenterLight"
  103. Grid.Row="2"
  104. Grid.Column="1"
  105. Fill="{StaticResource ProgressBarIndicatorLightingEffect}" />
  106. <Rectangle x:Name="RightLight"
  107. Grid.Row="2"
  108. Grid.Column="2"
  109. Fill="{StaticResource ProgressBarIndicatorLightingEffectRight}" />
  110. <Border x:Name="Highlight1"
  111. Grid.RowSpan="2"
  112. Grid.ColumnSpan="3"
  113. Background="{StaticResource ProgressBarIndicatorGlassyHighlight}" />
  114. <Border x:Name="Highlight2"
  115. Grid.RowSpan="2"
  116. Grid.ColumnSpan="3"
  117. Background="{StaticResource ProgressBarTopHighlight}" />
  118. </Grid>
  119. </Grid>
  120. </Decorator>
  121. <Border BorderBrush="{TemplateBinding BorderBrush}"
  122. BorderThickness="{TemplateBinding BorderThickness}"
  123. CornerRadius="2" />
  124. </Grid>
  125. <ControlTemplate.Triggers>
  126. <Trigger Property="Orientation" Value="Vertical">
  127. <Setter TargetName="TemplateRoot" Property="LayoutTransform">
  128. <Setter.Value>
  129. <RotateTransform Angle="-90" />
  130. </Setter.Value>
  131. </Setter>
  132. </Trigger>
  133. <Trigger Property="IsIndeterminate" Value="true">
  134. <Setter TargetName="LeftDark" Property="Visibility" Value="Collapsed" />
  135. <Setter TargetName="RightDark" Property="Visibility" Value="Collapsed" />
  136. <Setter TargetName="LeftLight" Property="Visibility" Value="Collapsed" />
  137. <Setter TargetName="CenterLight" Property="Visibility" Value="Collapsed" />
  138. <Setter TargetName="RightLight" Property="Visibility" Value="Collapsed" />
  139. <Setter TargetName="Indicator" Property="Visibility" Value="Collapsed" />
  140. </Trigger>
  141. <Trigger Property="IsIndeterminate" Value="false">
  142. <Setter TargetName="Animation" Property="Background" Value="{StaticResource ProgressBarForeground}" />
  143. </Trigger>
  144. </ControlTemplate.Triggers>
  145. </ControlTemplate>
  146. </Setter.Value>
  147. </Setter>
  148. </Style>
  149. </ResourceDictionary>