59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
|
|
// 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.
|
|||
|
|
|
|||
|
|
using WPFluent.Controls;
|
|||
|
|
|
|||
|
|
using WPFluent.Gallery.ViewModels.Pages.Navigation;
|
|||
|
|
|
|||
|
|
namespace WPFluent.Gallery.Views.Pages.Navigation;
|
|||
|
|
|
|||
|
|
public partial class NavigationPage : INavigableView<NavigationViewModel>
|
|||
|
|
{
|
|||
|
|
private readonly INavigationService _navigationService;
|
|||
|
|
|
|||
|
|
|
|||
|
|
public NavigationViewModel ViewModel { get; }
|
|||
|
|
|
|||
|
|
public NavigationPage(NavigationViewModel viewModel, INavigationService navigationService)
|
|||
|
|
{
|
|||
|
|
ViewModel = viewModel;
|
|||
|
|
DataContext = this;
|
|||
|
|
_navigationService = navigationService;
|
|||
|
|
|
|||
|
|
InitializeComponent();
|
|||
|
|
Loaded += HandleLoaded;
|
|||
|
|
Unloaded += HandleUnloaded;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void HandleLoaded(object sender, RoutedEventArgs e)
|
|||
|
|
{
|
|||
|
|
INavigationView? navigationControl = _navigationService.GetNavigationControl();
|
|||
|
|
if (
|
|||
|
|
navigationControl?.BreadcrumbBar != null
|
|||
|
|
&& navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed
|
|||
|
|
)
|
|||
|
|
{
|
|||
|
|
navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void HandleUnloaded(object sender, RoutedEventArgs e)
|
|||
|
|
{
|
|||
|
|
INavigationView? navigationControl = _navigationService.GetNavigationControl();
|
|||
|
|
if (
|
|||
|
|
navigationControl?.BreadcrumbBar != null
|
|||
|
|
&& navigationControl.BreadcrumbBar.Visibility != Visibility.Visible
|
|||
|
|
)
|
|||
|
|
{
|
|||
|
|
navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
Loaded -= HandleLoaded;
|
|||
|
|
Unloaded -= HandleUnloaded;
|
|||
|
|
}
|
|||
|
|
}
|