在 App.xaml 中定义了 Light 主题 ( <AcrylicBrush
TintColor="Red"/>
)、Dark、( )。<AcrylicBrush
TintColor="Orange"/>
根据这篇文章,将 UWP 项目的目标版本从 1803 更改为 1809 会禁用 NavigationView 的丙烯酸纹理 - 为什么?,我将以下内容添加到 ShellPage.xaml。当我在浅色和深色主题之间切换时的预期行为是应用程序NavigationView
控件将具有AcrylicBrush
在红色和橙色之间切换的色调。在下面的定义中,实际行为是保持橙色。
ShellPage.xaml:
<Page.Resources>
<StaticResource x:Key="NavigationViewExpandedPaneBackground"
ResourceKey="MyAcrylicBrush"/>
</Page.Resources>
应用程序.xaml:
<Application
x:Class="TEST.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<AcrylicBrush x:Key="MyAcrylicBrush"
BackgroundSource="HostBackdrop"
TintColor="Green"
TintOpacity="0.8" />
<AcrylicBrush x:Key="NavigationViewDefaultPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="Green"
TintOpacity="0.8" />
<AcrylicBrush x:Key="NavigationViewTopPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="Green"
TintOpacity="0.8" />
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="Green"
TintOpacity="0.8" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<AcrylicBrush x:Key="MyAcrylicBrush"
BackgroundSource="HostBackdrop"
TintColor="Orange"
TintOpacity="0.8" />
<AcrylicBrush x:Key="NavigationViewDefaultPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="Orange"
TintOpacity="0.8" />
<AcrylicBrush x:Key="NavigationViewTopPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="Orange"
TintOpacity="0.8" />
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="Orange"
TintOpacity="0.8" />
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<AcrylicBrush x:Key="MyAcrylicBrush"
BackgroundSource="HostBackdrop"
TintColor="Red"
TintOpacity="1"/>
<AcrylicBrush x:Key="NavigationViewDefaultPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="Red"
TintOpacity="1" />
<AcrylicBrush x:Key="NavigationViewTopPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="Red"
TintOpacity="1" />
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="Red"
TintOpacity="1"/>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>