简体   繁体   English

WP7 - 进度条

[英]WP7 - Progress Bar

What is the best way to structure a ProgressBar using Blend? 使用Blend构建ProgressBar的最佳方法是什么?

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. 我希望在ListBox后面有一个进度条,并在我的Web请求完成时隐藏它。 So, should I put the ListBox & ProgressBar into a StackPanel? 那么,我应该将ListBox和ProgressBar放入StackPanel吗? Or should I just programatically add or remove the ListBox / ProgressBar? 或者我应该以编程方式添加或删除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. 对于Windows Phone 7.5,您应该将SystemTray类与新的ProgressIndicator属性一起使用。 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. 如果您想在空ListBox的中间显示进度条,您可以安排两个控件,例如使用Grid,并根据需要切换可见性。 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. 但如上所述,最好将系统托盘用于状态信息,包括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! 但是,如果您使用SystemTray-Class或使用ProgressBar控件,您不仅应切换可见性,还应切换IsIndeterminate属性 - 即使ProgessIndicator不可见,它也会在“true”时使用资源!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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