繁体   English   中英

Windows手机性能进度条

[英]Windows phone performance progress bar

我正在开发Wp7中的应用程序,我想学习如何从基本执行wp7中的性能进度条。 我正在使用Windows Phone工具包来使用性能进度条..如何启动并停止它?

使用以下命令停止动画并从视图中隐藏控件:

myProgressBar.IsIndeterminate = False
myPragressBar.Visibility = Collapsed

试试这个:在Xaml中:

<ProgressBar HorizontalAlignment="Center" Name="progressBar1" IsIndeterminate="True"/>

当你想从代码中隐藏它然后使用

progressBar1.Visibility=Visibility.Collapsed;

在.cs文件中:

  using Microsoft.Phone.Shell;

 public partial class MainPage : PhoneApplicationPage
    {
        private ProgressIndicator _progressIndicator;

        public MainPage()
        {
            InitializeComponent();

            _progressIndicator = new ProgressIndicator
            {
                IsIndeterminate = true,
                Text = "Loading...",
                IsVisible = true,
            };

            SystemTray.SetIsVisible(this, true);
            SystemTray.SetProgressIndicator(this, _progressIndicator);
            SystemTray.SetOpacity(this, 1);

            //something is a very long here

            _progressIndicator.IsVisible = false;
            SystemTray.SetIsVisible(this, false);
        }
    }

如果您想使用确定进度条,您可以这样做:

<ProgressBar Value="25" ></ProgressBar>

此进度条为25%。

您还可以将其绑定到ViewModel中的属性,并可能添加转换器:

<ProgressBar Value="{Binding MyProgress, Converter={StaticResource ProgressConverter}}" ></ProgressBar>

暂无
暂无

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

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