App.xaml中的“定义的浅色”主题(<AcrylicBrush
TintColor="Red"/>
),深色((<AcrylicBrush
TintColor="Orange"/>
)。根据这篇Changing UWP project's Target Version from 1803 to 1809 disables NavigationView's Acrylic texture - why?的帖子,我将以下内容添加到ShellPage.xaml中。当我在浅色和深色主题之间切换时,预期的行为是应用程序NavigationView
控件将具有AcrylicBrush
色调,可在红色和橙色之间切换。在下面的定义中,实际行为是保持橙色。
ShellPage.xaml:
<Page.Resources>
<StaticResource x:Key="NavigationViewExpandedPaneBackground"
ResourceKey="MyAcrylicBrush"/>
</Page.Resources>
App.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>
答案 0 :(得分:1)
您可以直接将Key(NavigationViewExpandedPaneBackGround)提供给您的AcrylicBrush。因此,它将更改您的导航视图背景。
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground" BackgroundSource="HostBackdrop" TintColor="{ThemeResource SystemAccentColorDark1}" FallbackColor="{ThemeResource SystemAccentColorDark1}" TintOpacity="0.80"/>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground" BackgroundSource="HostBackdrop" TintColor="{ThemeResource SystemAltHighColor}" FallbackColor="#333333" TintOpacity="0.50"/>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Page.Resources>
答案 1 :(得分:0)