Beispiel #1
0
 private void Frame_Navigated(object sender, NavigationEventArgs e)
 {
     IsBackEnabled = _navigationService.CanGoBack();
     Selected      = _navigationView.MenuItems
                     .OfType <WinUI.NavigationViewItem>()
                     .FirstOrDefault(menuItem => IsMenuItemForPageType(menuItem, e.SourcePageType));
 }
Beispiel #2
0
    private bool IsMenuItemForPageType(WinUI.NavigationViewItem menuItem, Type sourcePageType)
    {
        var sourcePageKey = sourcePageType.Name;

        sourcePageKey = sourcePageKey.Substring(0, sourcePageKey.Length - 4);
        var pageKey = menuItem.GetValue(NavHelper.NavigateToProperty) as string;

        return(pageKey == sourcePageKey);
    }