using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Navigation;
using System;
// To learn more about WinUI, the WinUI
project structure,
// and more about our project templates,
see: http://aka.ms/winui-project-info.
namespace Downloader_WebBackups
{
/// <summary>
/// An empty window that
can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
//--< set App Title Bar >--
//*load XAML-code from mainwindow.xaml
file
ExtendsContentIntoTitleBar = true;
SetTitleBar(AppTitleBar);
//--</ set App Title Bar >--
}
//C#
code behind
private void navView_SelectionChanged(NavigationView
sender, NavigationViewSelectionChangedEventArgs args)
{
FrameNavigationOptions
navOptions = new
FrameNavigationOptions();
navOptions.TransitionInfoOverride
= args.RecommendedNavigationTransitionInfo;
if (sender.PaneDisplayMode == NavigationViewPaneDisplayMode.Top)
{
navOptions.IsNavigationStackEnabled = false;
}
Type pageType = typeof(Page_Download); //init
var selectedItem= (NavigationViewItem)args.SelectedItem;
if (selectedItem.Name ==
NavItem_Download.Name)
{
pageType = typeof(Page_Download);
}
else if (selectedItem.Name ==
NavItem_Folders.Name)
{
pageType = typeof(Page_Folders);
}
_ =
contentFrame.Navigate(pageType);// .NavigateToType(pageType, null,
navOptions);
}
}
}
|