Windows UWP 客製化狀態列
UWP專案 > 參考 > 加入參考 > Universal Windows > 擴充功能 > Windows Mobile Extensions for the UWP
接著,請修改 UWP 原生專案內的 App.xaml.cs 檔案,在 OnLaunched 方法內,加入底下程式碼;在底下程式碼,您可以設定狀態列的背景與文字顏色和透明度等屬性。
App.xaml.cs
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
//Mobile customization
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
var statusBar = StatusBar.GetForCurrentView();
if (statusBar != null)
{
statusBar.BackgroundOpacity = 1;
statusBar.BackgroundColor = Colors.Black;
statusBar.ForegroundColor = Colors.White;
}
}
Windows Mobile Extension for the UWP擴充功能加入到專案內。