Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can achieve any style you want by editing the <code>ControlTemplate</code> of the progress bar. Here's an example :</p> <p><strong>Disclaimer:</strong> I'm not a designer.</p> <pre><code>&lt;!-- Brushed used by the progress bar style --&gt; &lt;LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill" EndPoint="0,0" MappingMode="Absolute" StartPoint="-100,0"&gt; &lt;GradientStop Color="#00000000" Offset="0"/&gt; &lt;GradientStop Color="#FF000000" Offset="0.4"/&gt; &lt;GradientStop Color="#FF000000" Offset="0.6"/&gt; &lt;GradientStop Color="#00000000" Offset="1"/&gt; &lt;/LinearGradientBrush&gt; &lt;SolidColorBrush x:Key="ProgressBarTopHighlight" Color="#80FFFFFF" /&gt; &lt;!-- progress bar style --&gt; &lt;Style x:Key="FlatProgressBar" TargetType="{x:Type ProgressBar}"&gt; &lt;Setter Property="Foreground" Value="#01D328"/&gt; &lt;Setter Property="Background" Value="#C7C7C7"/&gt; &lt;Setter Property="BorderBrush" Value="#B2B2B2"/&gt; &lt;Setter Property="BorderThickness" Value="1"/&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type ProgressBar}"&gt; &lt;Grid x:Name="Background" SnapsToDevicePixels="true"&gt; &lt;Rectangle Fill="{TemplateBinding Background}" RadiusY="2" RadiusX="2"/&gt; &lt;Border Background="{x:Null}" CornerRadius="2" Margin="1"/&gt; &lt;Border BorderBrush="#80FFFFFF" BorderThickness="1,0,1,1" Background="{StaticResource ProgressBarTopHighlight}" Margin="1"/&gt; &lt;Rectangle x:Name="PART_Track" Margin="1"/&gt; &lt;Decorator x:Name="PART_Indicator" HorizontalAlignment="Left" Margin="1"&gt; &lt;Grid x:Name="Foreground"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition MaxWidth="15"/&gt; &lt;ColumnDefinition Width="0.1*"/&gt; &lt;ColumnDefinition MaxWidth="15"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition/&gt; &lt;RowDefinition/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Rectangle x:Name="Indicator" Grid.ColumnSpan="3" Fill="{TemplateBinding Foreground}" Grid.RowSpan="2"/&gt; &lt;Rectangle x:Name="Animation" Grid.ColumnSpan="3" Fill="{TemplateBinding Foreground}" Grid.RowSpan="2"&gt; &lt;Rectangle.OpacityMask&gt; &lt;MultiBinding&gt; &lt;MultiBinding.Converter&gt; &lt;Themes:ProgressBarHighlightConverter/&gt; &lt;/MultiBinding.Converter&gt; &lt;Binding Source="{StaticResource ProgressBarIndicatorAnimatedFill}"/&gt; &lt;Binding ElementName="Background" Path="ActualWidth"/&gt; &lt;Binding ElementName="Background" Path="ActualHeight"/&gt; &lt;/MultiBinding&gt; &lt;/Rectangle.OpacityMask&gt; &lt;/Rectangle&gt; &lt;/Grid&gt; &lt;/Decorator&gt; &lt;Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/&gt; &lt;/Grid&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property="Orientation" Value="Vertical"&gt; &lt;Setter Property="LayoutTransform" TargetName="Background"&gt; &lt;Setter.Value&gt; &lt;RotateTransform Angle="-90"/&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Setter Property="LayoutTransform" TargetName="PART_Track"&gt; &lt;Setter.Value&gt; &lt;RotateTransform Angle="90"/&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Setter Property="LayoutTransform" TargetName="PART_Indicator"&gt; &lt;Setter.Value&gt; &lt;RotateTransform Angle="90"/&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Setter Property="LayoutTransform" TargetName="Foreground"&gt; &lt;Setter.Value&gt; &lt;RotateTransform Angle="-90"/&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsIndeterminate" Value="true"&gt; &lt;Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsIndeterminate" Value="false"&gt; &lt;Setter Property="Fill" TargetName="Animation" Value="#80B5FFA9"/&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre> <p>Apply this style to your ProgressBar and you're good to go :</p> <pre><code>&lt;ProgressBar Style="{StaticResource FlatProgressBar}" Value="50" /&gt; </code></pre> <p>Here's the end result :</p> <p><img src="https://i.stack.imgur.com/KXA7K.gif" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload