WinUI 3 Desktop Navigation View Page

Viewed 671

I started using WinUI 3 to build a desktop program to replace the old WinForm program. I use NavigationView in the main Window to manage the pages in the program. The first page (frame) displayed will be a login screen. I want to disable the navigation menu and enabled when user login successful. My problem is how can I access the navigation menu in the frame (the page in the frame FMMain)?

<NavigationView x:Name="NVMenu" PaneDisplayMode="LeftCompact" IsSettingsVisible="False" IsPaneOpen="False">
    <NavigationView.MenuItems>
        <NavigationViewItem x:Uid="NVIHome" x:Name="NVIHome">
            <NavigationViewItem.Icon>
                <FontIcon x:Uid="FIHome"/>
            </NavigationViewItem.Icon>
        </NavigationViewItem>
    </NavigationView.MenuItems>
    <Frame x:Name="FMMain" />
</NavigationView>

Thank you.

2 Answers

You can have a global static property, which your login frame can access. Then, bind the 'Enabled' property of your Navigation view item to it.

Don't do that, winui3 is not production ready. I am strugling with many issues. To name a few - scrollview does not work properly (does not work at all, to be specific), badges are not implemented yet, window icon must be set with win32, if you need data table, community toolkit is only free way, but it does not support net6 yet...

Related