Live Chat Icon For mobile
Live Chat Icon

WPF FAQ - ProgressBar

Find answers for the most frequently asked questions
Expand All Collapse All

This can be done using the code given below.


        <Page xmlns=''
    xmlns:x='' >
            <!-- For demonstration purposes, animate ProgressBar.Value -->
                <EventTrigger RoutedEvent=’Page.Loaded’>
                        <Storyboard TargetName=’ProgressBar’ TargetProperty=’Value’>
                            <DoubleAnimation From=’0’ To=’100’ Duration=’0:0:1’ />
            <Grid Height='30' >
                <ProgressBar Name=’ProgressBar’ />
          <Style TargetType=’TextBlock’>
            <!-- Make the text 'Loading ...' by default-->
            <Setter Property=’Text’ Value=’Loading ...’ />          
            <!-- But when ProgressBar.Value is 100, change the text to 'Complete' -->
              <DataTrigger Binding=’{Binding Value, ElementName=ProgressBar}’ Value=’100’>
                <Setter Property=’Text’ Value=’Complete’ />


This example creates a ProgressBar and uses an ’animation’ to simulate the progress of an operation.


<StatusBar Name='sbar' 
           VerticalAlignment='Bottom' Background='Beige' >

    <TextBlock>Downloading File</TextBlock>
    <ProgressBar Width='100' Height='20'
        <EventTrigger RoutedEvent='ProgressBar.Loaded'>
                From='0' To='100' Duration='0:0:5'  />
  <StatusBarItem HorizontalAlignment='Right'>
    <Image Source='images\help.bmp' Width='16' Height='16'/>


Share with

Couldn't find the FAQs you're looking for?

Please submit your question and answer.