Using an image for the top of a ProgressBar's Value

n0kx 1 Reputation point
2020-03-24T17:36:14.687+00:00

Basically, I want to have a vertical ProgressBar that represents water and I'd like for the top of the ProgressBar line to be a wave instead of the default line.

Is there a way to use an image like that in the ProgressBar? I really just need to have an image that sits right at the top of the Value of the ProgressBar.

For example, A would be a normal ProgressBar and B is what I'd like to have.

Water-Progress-Bar.png

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,670 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Alex Li-MSFT 1,096 Reputation points
    2020-03-25T03:59:02.513+00:00

    Hi,

    Welcome to our Microsoft Q&A platform!

    example:

     <Grid>  
            <ProgressBar Width="200" Height="40" Name="progressBar1" Orientation="Horizontal" RenderTransformOrigin="0.5,0.5">  
                <ProgressBar.Template>  
                    <ControlTemplate TargetType="ProgressBar">  
                        <Border BorderBrush="Black" x:Name="Root" BorderThickness="0.5">  
                            <Grid Name="PART_Track"  >  
                                <Grid.ColumnDefinitions>  
                                    <ColumnDefinition Width="Auto"/>  
                                    <ColumnDefinition  Width="Auto"/>  
                                </Grid.ColumnDefinitions>  
                                <Path  StrokeThickness="1" Grid.Column="1" Fill="Blue">  
                                    <Path.Data>  
                                        <PathGeometry>  
                                            <PathFigure StartPoint="0,0">  
                                                <PolyLineSegment Points="10,4 8,8 10,12 8,16 7,20 8,24 10,28 7,32 9,36 0,40"></PolyLineSegment>  
                                            </PathFigure>  
                                        </PathGeometry>  
                                    </Path.Data>  
                                </Path>  
                                <Rectangle Name="PART_Indicator" HorizontalAlignment="Left" Fill="Blue"   Grid.Column="0" >  
      
                                </Rectangle>  
                                  
                            </Grid>  
                        </Border>  
                    </ControlTemplate>  
                </ProgressBar.Template>  
                <ProgressBar.RenderTransform>  
                    <TransformGroup>  
                        <RotateTransform Angle="270"/>  
                    </TransformGroup>  
                </ProgressBar.RenderTransform>  
            </ProgressBar>  
             
        </Grid>  
    

    5841-1.gif

    Thanks.

    0 comments No comments