diff --git a/src/Wpf.Ui.Gallery/App.xaml.cs b/src/Wpf.Ui.Gallery/App.xaml.cs index b3fa34b84..c3311f208 100644 --- a/src/Wpf.Ui.Gallery/App.xaml.cs +++ b/src/Wpf.Ui.Gallery/App.xaml.cs @@ -29,6 +29,7 @@ using Wpf.Ui.Gallery.Views.Pages.Icons; using Wpf.Ui.Gallery.Views.Pages.Media; using Wpf.Ui.Gallery.Views.Pages.Navigation; +using Wpf.Ui.Gallery.Views.Pages.Samples; using Wpf.Ui.Gallery.Views.Pages.StatusAndInfo; using Wpf.Ui.Gallery.Views.Pages.Text; using Wpf.Ui.Gallery.Views.Pages.Windows; @@ -49,7 +50,7 @@ public partial class App : Application // https://docs.microsoft.com/dotnet/core/extensions/logging private static readonly IHost _host = Host .CreateDefaultBuilder() - .ConfigureAppConfiguration(c => { c.SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)); }) + .ConfigureAppConfiguration(c => { c.SetBasePath(AppContext.BaseDirectory); }) .ConfigureServices((context, services) => { // App Host @@ -149,10 +150,17 @@ public partial class App : Application services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); + // Multilevel navigation sample Pages + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + // Status and Info services.AddTransient(); services.AddTransient(); diff --git a/src/Wpf.Ui.Gallery/ViewModels/Pages/Navigation/MultilevelNavigationSample.cs b/src/Wpf.Ui.Gallery/ViewModels/Pages/Navigation/MultilevelNavigationSample.cs new file mode 100644 index 000000000..976ded1d2 --- /dev/null +++ b/src/Wpf.Ui.Gallery/ViewModels/Pages/Navigation/MultilevelNavigationSample.cs @@ -0,0 +1,28 @@ +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT. +// Copyright (C) Leszek Pomianowski and WPF UI Contributors. +// All Rights Reserved. + +namespace Wpf.Ui.Gallery.ViewModels.Pages.Navigation; + +public partial class MultilevelNavigationSample +{ + public MultilevelNavigationSample(INavigationService navigationService) + { + _navigationService = navigationService; + } + + private readonly INavigationService _navigationService; + + [RelayCommand] + private void NavigateForward(Type type) + { + _navigationService.NavigateWithHierarchy(type); + } + + [RelayCommand] + private void NavigateBack() + { + _navigationService.GoBack(); + } +} diff --git a/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs index 3a64ec25c..502b8006f 100644 --- a/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs +++ b/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs @@ -91,6 +91,7 @@ public MainWindowViewModel(IServiceProvider serviceProvider) { new NavigationViewItem { Content = "BreadcrumbBar", TargetPageType = typeof(BreadcrumbBarPage) }, new NavigationViewItem { Content = "NavigationView", TargetPageType = typeof(NavigationViewPage) }, + new NavigationViewItem { Content = "Multilevel navigation", TargetPageType = typeof(MultilevelNavigationPage) }, new NavigationViewItem { Content = "TabControl", TargetPageType = typeof(TabControlPage) }, }}, new NavigationViewItem {Content = "Status and Info", Icon = new SymbolIcon { Symbol = SymbolRegular.ChatBubblesQuestion24 }, TargetPageType = typeof(StatusAndInfoPage), MenuItems = new ObservableCollection diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Navigation/MultilevelNavigationPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Navigation/MultilevelNavigationPage.xaml new file mode 100644 index 000000000..d3e8a0668 --- /dev/null +++ b/src/Wpf.Ui.Gallery/Views/Pages/Navigation/MultilevelNavigationPage.xaml @@ -0,0 +1,30 @@ + + + +