XAML ProgressBar Code Example

The code examples in this article demonstrates how to create a Windows app with a Progress bar control.

The <ProgressBar> element in XAML represents a Progress Bar control. The following code example creates a progresss bar in XAML. 
  1. <ProgressBar Margin="10,10,0,13" Name="ListView1" HorizontalAlignment="Left" VerticalAlignment="Top" Width="300" Height="30" />  
The Value property of ProgressBar sets up the current value of a ProgressBar control. In the following code, I set the Value property to 60. 
  1. <ProgressBar Margin="10,10,0,13" Name="PBar" HorizontalAlignment="Left"   
  2.       VerticalAlignment="Top" Width="300" Height="30" Value="60" >   
  3. </ProgressBar>  
The FlowDirection property sets the flow of the ProgressBar. You can set this value to either LeftToRight or RightToLeft. The default value is LeftToRight.
  1. FlowDirection="RightToLeft"  
The following code adds a StatusBar to WPF using XAML.
  1. <StatusBar Name="SBar" Grid.Column="0" Grid.Row="5" VerticalAlignment="Bottom" Background="LightBlue"  >  
  2.     <StatusBarItem>  
  3.         <TextBlock>Status:</TextBlock>  
  4.     </StatusBarItem>  
  5. </StatusBar>