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 LayoutViewModel = WPFluent.Gallery.ViewModels.Pages.LayoutViewModel;
|
|
|
|
namespace WPFluent.Gallery.Views.Pages;
|
|
|
|
public partial class LayoutPage : INavigableView<LayoutViewModel>
|
|
{
|
|
private readonly INavigationService _navigationService;
|
|
|
|
|
|
public LayoutViewModel ViewModel { get; }
|
|
|
|
public LayoutPage(LayoutViewModel 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;
|
|
}
|
|
}
|