How can I create a ProgressBar and use an animation to simulate the progress of an operation ?

Platform: WPF| Category: ProgressBar

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

[XAML]

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

  <StatusBarItem>
    <TextBlock>Downloading File</TextBlock>
  </StatusBarItem>
  <StatusBarItem>
    <ProgressBar Width='100' Height='20'
                 Name='progressBar1'>
      <ProgressBar.Triggers>
        <EventTrigger RoutedEvent='ProgressBar.Loaded'>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation
                Storyboard.TargetName='progressBar1' 
                Storyboard.TargetProperty='Value'
                From='0' To='100' Duration='0:0:5'  />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </ProgressBar.Triggers>
    </ProgressBar>
  </StatusBarItem>
  <StatusBarItem>
    <Separator/>	
  </StatusBarItem>
  <StatusBarItem>
    <TextBlock>Online</TextBlock>
  </StatusBarItem>
  <StatusBarItem HorizontalAlignment='Right'>
    <Image Source='images\help.bmp' Width='16' Height='16'/>
  </StatusBarItem>
</StatusBar>

Share with

Related FAQs

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

Please submit your question and answer.