我正在研究 UWP 的亚克力选项并遇到了一个奇怪的问题。本质上,我试图让导航视图使用自定义亚克力画笔。但是,主窗口背景比 Navigationview 更透明。我需要让 NavigationView 与当前主视图一样透明。我附上了一张图片来帮助澄清这一点。很难解释:
正如您在左侧看到的,导航视图不像右侧的主要功能窗口那样透明。我需要交换它,以便 NavigationView 比 MainPage 更透明。
这是我的 App.XAML
<Application
x:Class="BS.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BS">
<Application.Resources>
<AcrylicBrush x:Key="CustomAcrylicDark"
BackgroundSource="HostBackdrop"
TintColor="Gray"
TintOpacity="0.6"
FallbackColor="Black"/>
<AcrylicBrush x:Key="CustomAcrylicLight"
BackgroundSource="HostBackdrop"
TintColor="White"
TintOpacity="0.6"
FallbackColor="White"/>
</Application.Resources>
</Application>
这是我的 MainPage.XAML
<Page
x:Class="BS.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BS"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
RequestedTheme="Dark"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
</Page.Resources>
<Grid>
<NavigationView Background="{StaticResource CustomAcrylicDark}" PaneTitle="BS" IsBackButtonVisible="Collapsed" CompactModeThresholdWidth="9999" ExpandedModeThresholdWidth="9999" CompactPaneLength="96">
<NavigationView.MenuItems>
<NavigationViewItem Name="HItem" Content="HOME" Tag="HOME_Page" FontSize="22" HorizontalAlignment="Center" FontWeight="Bold" Foreground="MediumPurple"/>
<NavigationViewItemSeparator/>
<NavigationViewItem Name="OItem" Content="OVERVIEW" Tag="O_Page" FontSize="22" HorizontalAlignment="Center" FontWeight="Bold" Foreground="MediumPurple"/>
<NavigationViewItem Name="BItem" Content="BILLS" Tag="B_Page" FontSize="22" HorizontalAlignment="Center" FontWeight="Bold" Foreground="MediumPurple"/>
<NavigationViewItem Name="PItem" Content="PEOPLE" Tag="B_Page" FontSize="22" HorizontalAlignment="Center" FontWeight="Bold" Foreground="MediumPurple"/>
<NavigationViewItem Name="TItem" Content="TRANSFERS" Tag="T_Page" FontSize="22" HorizontalAlignment="Center" FontWeight="Bold" Foreground="MediumPurple"/>
<NavigationViewItem Name="PItem" Content="PAY DATES" Tag="P_Page" FontSize="22" HorizontalAlignment="Center" FontWeight="Bold" Foreground="MediumPurple"/>
</NavigationView.MenuItems>
</NavigationView>
</Grid>
</Page>
先感谢您。