ProgressBarStyle.xaml 6.61 KB
<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" mc:Ignorable="d">
	<LinearGradientBrush x:Key="ProgressBarBackgroundBrush" EndPoint="0.5,0.827" StartPoint="0.5,0.07">
		<GradientStop Color="#FFA6A6A6" Offset="0"/>
		<GradientStop Color="#FFF4F4F4" Offset="1"/>
		<GradientStop Color="#FFF7F7F7" Offset="0.907"/>
		<GradientStop Color="#FFE2E2E2" Offset="0.509"/>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarBorderBrush" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#B2B2B2" Offset="0"/>
		<GradientStop Color="#8C8C8C" Offset="1"/>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarGlassyHighlight" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#50FFFFFF" Offset="0.5385"/>
		<GradientStop Color="#00FFFFFF" Offset="0.5385"/>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarTopHighlight" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#80FFFFFF" Offset="0.05"/>
		<GradientStop Color="#00FFFFFF" Offset="0.25"/>
	</LinearGradientBrush>

	<RadialGradientBrush x:Key="ProgressBarIndicatorAnimatedFill" RadiusX="0.7" RadiusY="1" 
			Opacity="0.7" Center="0.5,1" GradientOrigin="0.5,1" >
		<GradientStop Color="Black" Offset="0"/>
		<GradientStop Color="Black" Offset="0.259"/>
		<GradientStop Color="#00000000" Offset="0.895"/>
	</RadialGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarIndicatorDarkEdgeLeft" EndPoint="1,0" StartPoint="0,0">
		<GradientStop Color="#0C000000" Offset="0"/>
		<GradientStop Color="#20000000" Offset="0.3"/>
		<GradientStop Color="#00000000" Offset="1"/>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarIndicatorDarkEdgeRight" EndPoint="1,0" StartPoint="0,0">
		<GradientStop Color="#00000000" Offset="0"/>
		<GradientStop Color="#20000000" Offset="0.7"/>
		<GradientStop Color="#0C000000" Offset="1"/>
	</LinearGradientBrush>
	<RadialGradientBrush x:Key="ProgressBarIndicatorLightingEffectLeft" RelativeTransform="1,0,0,1,0.5,0.5" RadiusX="1" RadiusY="1">
		<GradientStop Color="#60FFFFC4" Offset="0"/>
		<GradientStop Color="#00FFFFC4" Offset="1"/>
	</RadialGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarIndicatorLightingEffect" EndPoint="0,0" StartPoint="0,1">
		<GradientStop Color="#60FFFFC4" Offset="0"/>
		<GradientStop Color="#00FFFFC4" Offset="1"/>
	</LinearGradientBrush>
	<RadialGradientBrush x:Key="ProgressBarIndicatorLightingEffectRight" RelativeTransform="1,0,0,1,-0.5,0.5" RadiusX="1" RadiusY="1">
		<GradientStop Color="#60FFFFC4" Offset="0"/>
		<GradientStop Color="#00FFFFC4" Offset="1"/>
	</RadialGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarIndicatorGlassyHighlight" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#90FFFFFF" Offset="0.5385"/>
		<GradientStop Color="#00FFFFFF" Offset="0.5385"/>
	</LinearGradientBrush>
	<Style x:Key="ProgressBarStyle" TargetType="{x:Type ProgressBar}">
		<Setter Property="Foreground" Value="{DynamicResource ButtonNormalBackground}"/>
		<Setter Property="BorderBrush" Value="{DynamicResource OuterBorderBrushStyle}"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ProgressBar}">
					<Grid x:Name="Background" SnapsToDevicePixels="true">
						<Rectangle RadiusY="1" RadiusX="1" Fill="{TemplateBinding Background}"/>
						<Rectangle x:Name="PART_Track" Margin="1"/>
						<Decorator x:Name="PART_Indicator" HorizontalAlignment="Left" Margin="1">
							<Grid x:Name="Foreground">
								<Grid.ColumnDefinitions>
									<ColumnDefinition MaxWidth="15"/>
									<ColumnDefinition Width="0.1*"/>
									<ColumnDefinition MaxWidth="15"/>
								</Grid.ColumnDefinitions>
								<Grid.RowDefinitions>
									<RowDefinition/>
									<RowDefinition/>
								</Grid.RowDefinitions>
								<Rectangle x:Name="Indicator" Grid.ColumnSpan="3" Fill="{TemplateBinding Foreground}" Grid.RowSpan="2"/>

								<Rectangle x:Name="Animation" Grid.ColumnSpan="3" Grid.RowSpan="2" Fill="{DynamicResource TileQuadroBrushWhite}">
									<Rectangle.OpacityMask>
										<MultiBinding>
											<MultiBinding.Converter>
												<Themes:ProgressBarHighlightConverter/>
											</MultiBinding.Converter>
											<Binding Source="{StaticResource ProgressBarIndicatorAnimatedFill}"/>
											<Binding ElementName="Background" Path="ActualWidth"/>
											<Binding ElementName="Background" Path="ActualHeight"/>
										</MultiBinding>
									</Rectangle.OpacityMask>
								</Rectangle>
								<Rectangle x:Name="LeftDark" Fill="{StaticResource ProgressBarIndicatorDarkEdgeLeft}" Margin="1,1,0,1" RadiusY="1" RadiusX="1" Grid.RowSpan="2"/>
								<Rectangle x:Name="RightDark" Grid.Column="2" Fill="{StaticResource ProgressBarIndicatorDarkEdgeRight}" Margin="0,1,1,1" RadiusY="1" RadiusX="1" Grid.RowSpan="2"/>
								<Rectangle x:Name="LeftLight" Grid.Column="0" Fill="{StaticResource ProgressBarIndicatorLightingEffectLeft}" Grid.Row="2"/>
								<Rectangle x:Name="CenterLight" Grid.Column="1" Fill="{StaticResource ProgressBarIndicatorLightingEffect}" Grid.Row="2"/>
								<Rectangle x:Name="RightLight" Grid.Column="2" Fill="{StaticResource ProgressBarIndicatorLightingEffectRight}" Grid.Row="2"/>
								<Border x:Name="Highlight1" Background="{StaticResource ProgressBarIndicatorGlassyHighlight}" Grid.ColumnSpan="3" Grid.RowSpan="2"/>
								<Border x:Name="Highlight2" Background="{StaticResource ProgressBarTopHighlight}" Grid.ColumnSpan="3" Grid.RowSpan="2"/>
							</Grid>
						</Decorator>
						<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="Orientation" Value="Vertical">
							<Setter Property="LayoutTransform" TargetName="Background">
								<Setter.Value>
									<RotateTransform Angle="-90"/>
								</Setter.Value>
							</Setter>
							<Setter Property="LayoutTransform" TargetName="PART_Track">
								<Setter.Value>
									<RotateTransform Angle="90"/>
								</Setter.Value>
							</Setter>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="SnapsToDevicePixels" Value="True"/>
		<Setter Property="Background" Value="{DynamicResource ProgressBarBackgroundBrush}"/>
	</Style>
<!-- Resource dictionary entries should be defined here. -->
</ResourceDictionary>