Home > OS >  WinUI 3 Desktop Navigation View Page
WinUI 3 Desktop Navigation View Page

Time:01-11

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.

CodePudding user response:

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.

  •  Tags:  
  • Related