"Nested properties are not supported" 尝试覆盖强调色时 [UWP]

"Nested properties are not supported" when trying to override accent color [UWP]

我试图覆盖我的 UWP 应用程序中的强调色,但是当我将代码添加到 App.xaml 时,出现错误 "Nested properties are not supported"。是否是因为在同一代码中我还覆盖了 InkToolbar 的颜色?

这是我的 App.xaml:

<Application
    x:Class="App12.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App12"
    RequestedTheme="Light">
    <Application.Resources>
        <SolidColorBrush x:Key="InkToolbarButtonBackgroundThemeBrush">Transparent</SolidColorBrush>
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Default">
                <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Orange" />
            </ResourceDictionary>
            <ResourceDictionary x:Key="Dark">
                <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Green" />
            </ResourceDictionary>
            <ResourceDictionary x:Key="Light">
                <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Blue" />
            </ResourceDictionary>
        </ResourceDictionary.ThemeDictionaries>
    </Application.Resources>
</Application>

您需要将它们包裹在 ResourceDictionary.

<Application.Resources>
    <ResourceDictionary> <!-- this -->
        <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Orange" />
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Default">
                <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Orange" />
            </ResourceDictionary>
            <ResourceDictionary x:Key="Dark">
                <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Green" />
            </ResourceDictionary>
            <ResourceDictionary x:Key="Light">
                <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Blue" />
            </ResourceDictionary>
        </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary> <!-- this -->
</Application.Resources>