简体   繁体   中英

WP7 - Progress Bar

What is the best way to structure a ProgressBar using Blend?

Right now I have

LayoutRoot > Panorama > PanoramaItem > ListBox

I want to have a progress bar 'behind' the ListBox, and hide it when my web request finishes. So, should I put the ListBox & ProgressBar into a StackPanel? Or should I just programatically add or remove the ListBox / ProgressBar?

I just want to do this the best way possible. Most of the tutorials I find are for progress bars that are just underneath an area of fixed height, and hid when loading completes.

With Windows Phone 7.5 you should use the SystemTray-class with the new ProgressIndicator property. It enables you to provide a progress indicator quick and easy and with a consistent look'n'feel for the user at the top of your screen. This would be the best user-experience possible (see image below) :-)

在此输入图像描述

If you want to show the progressbar nevertheless in the middle of the empty ListBox you can arrange both controls for example with a Grid and toggle the visibility as you need it. Removing and re-creating those controls isn't recommened because it would use a much larger overhead in the background and may be not very performant. But as mentioned above it would be best-practice to use the system tray for status information, including the ProgressBar.

But wether you use the SystemTray-Class or using a ProgressBar control, you shouldn't only toggle the visibility, but also toggle the IsIndeterminate property - it's using resources when "true", even if the ProgessIndicator isn't visible!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM