SystemTray(电池栏)
这个地方是显示手机的一些状态信息的,具体能显示写什么信息就不在这里讨论,这里讲讲能对他做些什么操作。
先选中当前页面,在右边的属性页将显示当前页面的属性。
属性中唯一与SystemTray相关的操作是控制SystemTray的显示。如下图,
通过勾选“Show SystemTray”就能控制SystemTray的显示了。
其实对SystemTray的操作不仅仅如此,SystemTray还有其他的属性,不过其他属性的设置需要在xaml文件中写了。
如果你在“Show SystemTray”出选中,即为显示SystemTray,你在当页的xaml文件中将会找到如下代码
,没错,这里就是修改SystemTray其他属性的地方了,输入shell:SystemTray并输入点,你会看到SystemTray的全部属性,
你在这里就可以改SystemTray的属性了。
BackgroundColor背景色
ForegroundColor前景色
IsVisible是否显示(“Show SystemTray”对应的属性)
Opacity透明度(如果值小于1,则SystemTray不会占据页面的的位置)
ProgressIndicator可以显示进度条以及一些文字信息,不过这个属性一般都在cs文件中操作,Demo可以在微软给出的官方代码中找到。
shell:SystemTray.IsVisible="True" shell:SystemTray.BackgroundColor="Red"
shell:SystemTray.ForegroundColor="Yellow" shell:SystemTray.Opacity="0.5"
public partial class MainPage : PhoneApplicationPage
{
private Microsoft.Phone.Shell.ProgressIndicator _progressIndicator = null;
public MainPage()
{
InitializeComponent();
}
private void PhoneApplicationPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
_progressIndicator = new Microsoft.Phone.Shell.ProgressIndicator();
Microsoft.Phone.Shell.SystemTray.ProgressIndicator = _progressIndicator;
_progressIndicator.Text = "加载中...";
_progressIndicator.IsIndeterminate = true;
_progressIndicator.IsVisible = true;
}
}
效果: