Why doesn't my progressbar show in the Windows Phone 7 emulator?
I have tried adding a progressbar to my Windows Phone 7 application, but it doesn't show in the emulator. Am I doing something wrong? Can you give me an example of how to implement the progressbar?
I actually put the progress bar on a grid with a Panorama control. It seems that the Panorama control sits on top of the progress bar unless you set its visibility to collapsed. Once I set the Panorama control's visibility to collapsed, I could see the progress bar. Thanks for all your he开发者_StackOverflowlp, though.
With IsIndeterminate = false, you simply write code to update ProgressBar.Value to reflect how far through your processing your are.
This assumes you can quantify your progress of whatever processing you are doing in terms of a percentage.
For cases where you can't quantify this, say for example downloading content of unknown size, you can set IsIndeterminate = true.
Early on it was recognised the storyboards used to implement the IsIndeterminate = true ProgressBar animation were very costly and had not been implemented on the render thread.
In response Jeff Wilcox posted this solution.
Jeff Wilcox – A high performance ProgressBar for Windows Phone
And this update, which Matt has referred you to.
Jeff Wilcox – Windows Phone performance progress bar update: part 2, remember to turn IsIndeterminate off when not needed!
Do not use the progres bar which ships with the SDK.
Use this instead.
You use it like this (from the above linked page):
<ProgressBar HorizontalAlignment="Left" VerticalAlignment="Center"
IsIndeterminate="{Binding IsProgressBarVisible}"
Style="{StaticResource PerformanceProgressBar}"
Visibility="{Binding IsProgressBarVisible, Converter={StaticResource VisibilityConverter}}" />
You either need to set a value on it, or set IsIndeterminate=true
, or it doesn't show/do anything.
You can set the Canvas.ZIndex property to put in front of the panorama controls.
E.g.
<ProgressBar x:Name="ProgressBar"
Canvas.ZIndex="100"
Width="400" Height="30"
IsIndeterminate="True"/>
精彩评论