您的位置:首页 > 其它

UWP tips (与wp8.1的不同)

2015-10-07 17:28 239 查看
一、异步调用之后,要更新UI时,代码如下

await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
test.Text = "abc";
});


二、原来的ApplicationBar更改为CommandBar

<AppBarButton Label="评价" Click="appbarRank_Click">
<AppBarButton.Icon>
<BitmapIcon UriSource="Images/Tools/pingjia.png" />
</AppBarButton.Icon>
</AppBarButton>
<CommandBar.SecondaryCommands>
<AppBarButton Icon="Like" Label="Like" IsCompact="True"/>
<AppBarButton Icon="Dislike" Label="Dislike" />
</CommandBar.SecondaryCommands>


三、原来在wp8.1中状态栏StatusBar类在UWP中也发生了改变

现在要控制UWP状态栏(显示信号、时间),可以用以下的方法

1.在项目中选择 添加引用

2.选择 Universal Windows , Extensions

3.将Windows Mobile Extensions for the UWP添加进项目中

代码:

if(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
StatusBar statusBar = StatusBar.GetForCurrentView();
statusBar.ForegroundColor = Colors.White;//设置状态栏信号、时间等图标的颜色
await statusBar.HideAsync();//隐藏状态栏
}


四、PC/Mobile的UWP开发中如果要用到WebView,可以先用windows 10的edge浏览器调试。在edge浏览器中调出F12开发人员工具,选择“仿真”,模式中有桌面和windows10移动版选择。

五、Segoe MDL2图标指南,地址:https://msdn.microsoft.com/zh-cn/library/windows/apps/xaml/jj841126.aspx

Segoe MDL2图标样式与对应代码可以用cortana搜索“字符映射表”
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: