C# 状态栏的颜色-Windows 10 Mobile

C# 状态栏的颜色-Windows 10 Mobile,c#,uwp,windows-10-mobile,template10,C#,Uwp,Windows 10 Mobile,Template10,我正在开发一个uwp应用程序,我正在使用template10。在模板10中,有一个选择暗主题或亮主题的选项。当我选择深色主题时,Windows10Mobile的状态栏是黑色的(到目前为止还不错),但当我选择浅色主题时,状态栏是白色的。我希望状态栏是黑色的(与黑暗主题一样),当选择光明主题时。有可能吗?您可以使用以下代码设置状态栏的颜色: StatusBar.GetForCurrentView().BackgroundColor = Colors.Black; 您可以使用以下代码设置状态栏的颜色

我正在开发一个uwp应用程序,我正在使用template10。在模板10中,有一个选择暗主题或亮主题的选项。当我选择深色主题时,Windows10Mobile的状态栏是黑色的(到目前为止还不错),但当我选择浅色主题时,状态栏是白色的。我希望状态栏是黑色的(与黑暗主题一样),当选择光明主题时。有可能吗?

您可以使用以下代码设置状态栏的颜色:

StatusBar.GetForCurrentView().BackgroundColor = Colors.Black;

您可以使用以下代码设置状态栏的颜色:

StatusBar.GetForCurrentView().BackgroundColor = Colors.Black;
不幸的是,它不应该是,因为我使用的是Template10

模板10不应影响状态栏。请将状态栏的
BackgroundOpacity
设置为
1
,然后再次测试

StatusBar.GetForCurrentView().BackgroundColor = Colors.Black;
StatusBar.GetForCurrentView().BackgroundOpacity = 1;
不幸的是,它不应该是,因为我使用的是Template10

模板10不应影响状态栏。请将状态栏的
BackgroundOpacity
设置为
1
,然后再次测试

StatusBar.GetForCurrentView().BackgroundColor = Colors.Black;
StatusBar.GetForCurrentView().BackgroundOpacity = 1;

请确保添加对Windows Mobile Extensions for UWP的引用,上述代码将为您执行此操作。不幸的是,此操作不正确:(应该是因为我使用的是Template10请确保添加对Windows Mobile Extensions for UWP的引用,上述代码将为您执行此操作。不幸的是,此操作不正确:(应该是因为我使用的是Template10