|
In this short article, I will talk about PerformanceProgressBar which is part of Silverlight Windows Phone toolkit.
When we don't know how much time any such action is going to take like when we call web service we are not sure how much time it is going to take, in such case we use indeterminate progress bar.
There is already PrgoressBar available with the Windows Phone tool but there is performance issue, it runs on UI thread and sucks the CPU time. The worst is even though it is not visible it continues to suck the CPU.
On other hand if PerofrmanceProgressBar is implemented on composition thread which gives better performance in compare to ProgressBar comes along with Windows Phone tool.
Use PerformanceProgressBar only when the response is indeterminate, otherwise use regular ProgressBar.
Whenever you are using PeformanceProgressBar of Silverlight Windows Phone Toolkit or Progress Bar or Windows Phone, even when you set the visible property to collapse it continues to suck the CPU. Make sure to set the IsIndeterminated to false also along with setting up visible to collaped.
PerformanceProgressBar has two important properties:
1. ActualIsIndeterminate get or sets the value indicating whether the actual indeterminate property should be reflecting a particular value.
2. IsIndeterminate get or sets value indicating whether the control is in the indeterminate state.
To use PerformanceProgressBar
Step 1: Download Silverlight Windows Phone Toolkit
Step 2: Create a silverlight for Windows Phone project.
Step 3: Add reference of Microsoft.Phone.Controls.Toolkit.dll
Step 4: Add namespace of Microsoft.Phone.Controls.Toolkit in MainPage.xaml.
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
Step 5: Add PerformanceProgressIndicator inside ContentPanel grid of MainPage.xaml.
< toolkit:PerformanceProgressBar x:Name="performanceProgressBar" Foreground="Red" Background="Red" IsIndeterminate="True"/>
Step 6: Set the IsIndeterminate to false when it is set as collapsed.
if (performanceProgressBar.Visibility == Visibility.Collapsed) { performanceProgressBar.IsIndeterminate = true; performanceProgressBar.Visibility = Visibility.Visible; } else { performanceProgressBar.IsIndeterminate = false; performanceProgressBar.Visibility = Visibility.Collapsed; }
I use ProgressIndicator on SystemTray because it gives much better performance in compare to ProgressBar of Windows Phone Tool and PerformanceProgressBar of Silverlight Windows Phone Toolkit.
Refer ProgressIndicator on SystemTray
This ends the article of IsIndeterminate PeformanceProgressBar in Windows Phone.
|