wpfui icon indicating copy to clipboard operation
wpfui copied to clipboard

NavigationViewItem.MenuItems inside a NavigationView.MenuItems crash

Open Coloris opened this issue 2 years ago • 2 comments

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

Coloris avatar Jul 05 '23 02:07 Coloris

Me too.

wzhan1988 avatar Dec 24 '23 02:12 wzhan1988

It seems that the 'AddItemsToAutoSuggestBoxItems' function has fallen into an infinite loop, there doesn't seem to be any issue with binding to the List<NavigationViewItem> created using code.

aiqinxuancai avatar Feb 23 '24 10:02 aiqinxuancai