microsoft-ui-xaml
microsoft-ui-xaml copied to clipboard
Cannot change NavigationViewItem foreground color in Top mode
Describe the bug
NavigationViewItem Foreground is not respected in Top mode.
This closed issue #2105 might be related.
Steps to reproduce the bug
<NavigationView PaneDisplayMode="Top">
<NavigationView.MenuItems>
<NavigationViewItem Content="Default Menu Item" />
<NavigationViewItem Content="Red Menu Item" Foreground="Red" />
<NavigationViewItem Content="Green Menu Item" Foreground="Green" />
<NavigationViewItem Content="Blue Menu Item" Foreground="Blue" />
</NavigationView.MenuItems>
</NavigationView>
Expected behavior
NavigationViewItem foreground should change in Top mode as it does in Left mode.
Screenshots
Left mode works.

Top mode doesn't work.

NuGet package version
WinUI 3 - Windows App SDK 1.1.3
Windows app type
- [ ] UWP
- [X] Win32
Device form factor
Desktop
Windows version
Windows 11 (22H2): Build 22621, Windows 11 (21H2): Build 22000
Additional context
I also checked these properties but they work without a problem.
BackgroundFontSizeFontWeight
NavigationViewItem Top style is likely not template binding correctly to the foreground property
Removing this line fixes the issue. I'm not sure why there's a separate foreground for Top style.
<Setter Target="NavigationViewItemPresenter.Foreground" Value="{ThemeResource TopNavigationViewItemForeground}" />
Closing this because it works on WindowsAppSDK v1.3.230602002.