ProgressBar 自我学习笔记(一)

1.

<Controls:ProgressOverlay Name="progressOverlay" >
   <Controls:ProgressOverlay.Content>
      <TextBlock>Loading</TextBlock>
   </Controls:ProgressOverlay.Content>
</Controls:ProgressOverlay>

网上一搜带文字的进度条就会搜到这段代码,而且这段代码很简洁,但是每当我们加入项目中去,发现没有作用,为什么呢?

原因:是因为那个Coding4Fun是旧的DLL,用1.61版的不行。所以还是要引用老版本的DLL;

2.

使用 SystemTray 可以從設計介面的 XAML 檔案以及程式碼來下手,首先如果要在 XAML 中最上層的 <phone:PhoneApplicationPage>標籤中加入下列的屬性:

<phone:PhoneApplicationpage
  ...
  xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
  ...
  shell:SystemTray.BackgroundColor="<背景顏色>"
  shell:SystemTray.ForegroundColor="<前景顏色>"
  shell:SystemTray.Opacity="<透明度>"
  shell:SystemTray.IsVisible="<啟動時是否顯示>">
    ...
</phone:phoneapplicationpage>

這些屬性是用來指定 SystemTray 控制項一些基本視覺元素,但光是這樣還沒辦法讓它成為讀取的提示,還需要在程式裡面指定 ProgressIndicator 才行,程式的操作範例如下:

using Microsoft.Phone.Shell;
...
// 建立 ProgressIndicator 並設定給 SystemTray
ProgressIndicator pi = new ProgressIndicator();
pi.Text = "Loading...";
pi.IsIndeterminate = true;
pi.IsVisible = true;
SystemTray.SetProgressIndicator(this, pi);

...

// 讓 SystemTray 顯示或隱藏
SystemTray.IsVisible = <true|false>;

這樣做出來的效果就會像是這樣(BackgrounColor="Blue" ForegroundColor="White"):

原文地址:https://www.cnblogs.com/Yukang1989/p/2845517.html