I’m having an issue with the NavigationPane from WinUI that I can’t seem to fix. In where the content of the pane should be, it changes the color of the background slightly, I’ve looked everywhere but I can’t find a solution.
(https://i.sstatic.net/f55UFde6.png)
My XamlCode (I’m using WinEx)
<?xml version="1.0" encoding="utf-8"?>
<winex:WindowEx
xmlns:winex="using:WinUIEx"
Width="800"
Height="500"
MinHeight="500"
MaxHeight="500"
MinWidth="800"
MaxWidth="800"
x:Class="Hostware.Hostware"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Hostware"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel Background="Orange">
<!-- For the top nav collapsing to left hamburger sample -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{x:Bind nvSample2.CompactModeThresholdWidth}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="nvSample2.PaneDisplayMode" Value="Top"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<!-- Example on how to override NavView acrylic -->
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="myBrush" Color="{StaticResource SystemBaseHighColor}" />
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground"
TintColor="White"
TintOpacity="0.8"
FallbackColor="#F2F2F2" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="myBrush" Color="{StaticResource SystemBaseHighColor}" />
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground"
TintColor="#1F1F1F"
TintOpacity="0.8"
FallbackColor="#1F1F1F" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="myBrush" Color="{ThemeResource SystemColorButtonFaceColor}"/>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</StackPanel.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<NavigationView x:Name="nvSample2" Grid.Row="1" Height="460" Header="This is Header Text" PaneDisplayMode="Auto" IsTabStop="False" AlwaysShowHeader="False" Background="Transparent" SelectionChanged="NavigationView_SelectionChanged2" >
<NavigationView.Resources>
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="Transparent"/>
<SolidColorBrush x:Key="NavigationViewDefaultPaneBackground" Color="Transparent" />
</NavigationView.Resources>
<NavigationView.MenuItems>
<NavigationViewItem Content="Menu Item1" Tag="SamplePage1" Icon="Play" />
<NavigationViewItem Content="Menu Item2" Tag="SamplePage2" Icon="Save" />
<NavigationViewItem Content="Menu Item3" Tag="SamplePage3" Icon="Refresh" />
<NavigationViewItem Content="Menu Item4" Tag="SamplePage4" Icon="Download" />
</NavigationView.MenuItems>
<!--<Frame Margin="0,0,0,0" x:Name="contentFrame5" Background="Transparent"/> -->
</NavigationView>
</Grid>
</StackPanel>
</winex:WindowEx>
I’ve tried setting background of the content frame, expected it to fix it, it did nothing
The only thing that can remove the color change is setting the NavigationView element invisible. so it might be some sort of property that I can’t find even when looking at the documentation.
Kalib Story is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.