NavigationViewItem.MenuItems inside a NavigationView.MenuItems crash
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Trying to use a NavigationViewItem.MenuItems inside a NavigationView.MenuItems crashes the XAML Designer :
The XAML Designer has exited unexpectedly. (Exit code: c00000fd)
Launching the app also throw and exception :
System.StackOverflowException: 'Exception_WasThrown'
To Reproduce
<ui:FluentWindow
x:Class="WpfApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="WpfApp"
Width="800"
Height="450"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
ExtendsContentIntoTitleBar="True"
WindowBackdropType="Mica"
WindowCornerPreference="Default"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ui:TitleBar
x:Name="TitleBar"
Title="WpfApp"
Grid.Row="0"
CloseWindowByDoubleClickOnIcon="True" />
<ui:NavigationView Grid.Row="1">
<ui:NavigationView.MenuItems>
<ui:NavigationViewItem Content="Home" />
<ui:NavigationViewItem Content="My Collections">
<ui:NavigationViewItem.MenuItems>
<ui:NavigationViewItem Content="Books" />
<ui:NavigationViewItem Content="DVDs" />
</ui:NavigationViewItem.MenuItems>
</ui:NavigationViewItem>
</ui:NavigationView.MenuItems>
</ui:NavigationView>
</Grid>
</ui:FluentWindow>
Expected behavior
A NavigationView control with a Home ViewItem and a My Collections ViewItem which is made of two sub-items : Books and DVDs
Screenshots
No response
OS version
Windows 11 22h2 - Version 22621.1848
Visual Studio 2022 - Version 17.6.4
.NET version
.net 6.0
WPF-UI NuGet version
3.0.0-preview.3
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided nested NavigationView.MenuItems and NavigationViewItem.MenuItems reproduction on WPF-UI 3.0.0-preview.3, focusing on the NavigationView and NavigationViewItem entry points. Reproduce the designer crash and runtime StackOverflowException, then confirm that nested items render without recursion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100