Long-running tasks in any application make the application or software nonresponsive. So to keep the user updated about the running task and also to keep the application responsive while executing the long-running tasks, we can use different kinds of loading bar options, such as -
- Progress Bar
- Ring Bar etc.
Let's discuss XAML Progress Bar in WPF Apps.
What is Progress Bar?XAML Progress Bar represents a control that indicates that an operation is ongoing. It looks like this.

XAML Progress Bar has 2 states.
- Determinate
- Indeterminate
Determinate
In this state, the user will be aware of the amount of the operation which has been completed.

Indeterminate
We use this state of progress bar when not sure about the total execution time of a lengthy task. See the second-to-last picture to see its shape.

Getting started with a simple example
Open Visual Studio and make a blank WPF App.


We need 4 controls to implement the Progress Ring Control in this app.
- Button
- Progress Bar
- 2 Text blocks
Button to start a lengthy task, 1 label to show time, and other to show status.
Make a grid and place these controls accordingly.
- <Window x:Class="WPFProgressBar.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:WPFProgressBar"
- mc:Ignorable="d"
- Title="MainWindow" Height="350" Width="525">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition></RowDefinition>
- <RowDefinition></RowDefinition>
- <RowDefinition></RowDefinition>
- <RowDefinition></RowDefinition>
- <RowDefinition></RowDefinition>
- </Grid.RowDefinitions>
- <Button Grid.Row="1" x:Name="btn_StartLengthyTask" Click="btn_StartLengthyTask_Click" Width="200" Height="30" >Start Lengthy Task</Button>
- <ProgressBar Grid.Row="2" x:Name="pb_LengthyTaskProgress" Margin="10,20" Value="10" ></ProgressBar>
- <TextBlock Grid.Row="3" x:Name="lbl_CountDownTimer" HorizontalAlignment="Center" > 00:10</TextBlock>
- <TextBlock Grid.Row="4" x:Name="lbl_TaskStatus" >Status...</TextBlock>
- </Grid>
- </Window>


Saurabh MishraPosted Aug 13, 2019, 6:40 AM
<ProgressBar x:Name="progressBar1" Margin="5,5,0,0" IsIndeterminate="True" ></ProgressBar>
Saurabh MishraPosted Aug 13, 2019, 6:39 AM
How-do-you-show-progress-when-indeterminate-true-in-a-wpf-progress-bar