Windows 10 UWP程序標題欄設置


在Windows 10程序中,以前只能用於全屏方式的Metro程序現在可以運行在窗口模式下了,並且改了個新名字,叫Windows 通用程序(Universal Windows app),簡稱UWP程序。新的UWP程序雖然大體上還是和以前的Metro程序差不多的,但還是引入了一點新東西的,本文這里就介紹一下它的標題欄設置的幾個特性。

 隱藏標題欄:

將應用界面擴展至 Titlebar 區域

    CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

 

修改標題欄顏色:

    var tiWtleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar;
    titleBar.BackgroundColor = Colors.DarkBlue;
    titleBar.ForegroundColor = Colors.White;
    titleBar.ButtonHoverBackgroundColor = Colors.LightBlue;
    titleBar.ButtonBackgroundColor = Colors.Maroon;
    titleBar.ButtonForegroundColor = Colors.White;

 

自定義標題欄控件:

可以將界面中任意控件指定為標題欄,指定后該控件將具有標題欄的行為特性,如拖動窗口、右鍵彈出窗口操作菜單等。

    Window.Current.SetTitleBar(grid);


免責聲明!

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



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