为什么UWP ApplicationPageBackgroundThemeBrush总是白色的?

She*_*een 5 xaml win-universal-app windows-10

我是初学者.我有以下最简单的代码:

<Page
    x:Class="ClientFramework.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ClientFramework"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    </Grid>
</Page>
Run Code Online (Sandbox Code Playgroud)

我在Windows Mobile 10模拟器中测试它.无论我如何改变操作系统主题,黑暗或光明,我的应用程序的背景总是白色的.那么设置与主题相关的应用程序范围颜色的正确方法是什么?

She*_*een 12

我最终通过谷歌搜索找出问题.问题是由VS2015项目模板引起的.在app.xaml中,有一行设置RequestedTheme ="Light".我删除了线,现在一切都很好.浪费了我2个小时.希望你看到我的答案,从而节省时间.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/c12cdba4-093f-474a-9d21-6e447aaa2adf/uwp-applicationpagebackgroundthemebrush-is-always-white?forum=wpdevelop&prof=required