UWP tips (與wp8.1的不同)


一、異步調用之后,要更新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搜索“字符映射表”


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM