Files
Shrlalgo.RvKits/WPFluent.Gallery/Views/Pages/StatusAndInfoPage.xaml.cs
2025-04-24 20:56:44 +08:00

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