Report Progress Value
This topic will describe the scenario in which you have a determined RadBusyIndicator control which you want to be available for a predefined amount of time. In this case the RadBusyIndicator provides you out of the box with a way to visualize the progress.
To read more about the determined and indetermined RadBusyIndicator control's modes, look here.
In the following example the only content of the RadBusyIndicator control is a Button. When the user clicks on that button the RadBusyIndicator will be enabled for a predefined amount of time. In this example, this is achieved by using a DispatcherTimer timer object which Tick event will change the RadBusyIndicator's progress value.
The first thing you have to do is to specify that you want your indicator to be determined. You do this by setting its IsIndetermined boolean property to False.
Setting IsIndeterminate
Notice that you have also defined the ProgressValue property. For the purpose of this example, by using data binding you have bound it to a property named in the same way located in the code-behind. Through this binding you will be changing this property to report any shifts in the RadBusyIndicator's progress value.
You can further change the default way of the progress changes notifications by customizing the Busy Content.
In the code behind you have to:
Create and initialize the DispathcherTimer object.
-
Handle the click event for the button:
Enable RadBusyIndicator by setting its IsBusy property to True.
Start the timer which will represent the ongoing process.
-
Handle the tick event for the timer:
Modify the progress value.
Disable the RadBusyIndicator by setting its IsBusy property to False in a specific condition.
In order to use the DispatcherTimer and the INotifyPropertyChanged interface you will need to add the following usings/imports:
- System.ComponentModel
- System.Windows.Threading
ProgressDetermination class implementation
Here is the final result: