77 lines
2.6 KiB
C#
77 lines
2.6 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 DialogsAndFlyoutsViewModel = WPFluent.Gallery.ViewModels.Pages.DialogsAndFlyoutsViewModel;
|
|
|
|
namespace WPFluent.Gallery.Views.Pages;
|
|
|
|
public partial class DialogsAndFlyoutsPage : INavigableView<DialogsAndFlyoutsViewModel>
|
|
{
|
|
private readonly INavigationService _navigationService;
|
|
|
|
|
|
public DialogsAndFlyoutsViewModel ViewModel { get; }
|
|
|
|
public DialogsAndFlyoutsPage(DialogsAndFlyoutsViewModel 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);
|
|
}
|
|
|
|
//INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
|
|
//if (selectedItem != null)
|
|
//{
|
|
// string? newTitle = selectedItem.Content?.ToString();
|
|
// if (MainTitle.Text != newTitle)
|
|
// {
|
|
// MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
|
|
// }
|
|
|
|
// if (selectedItem.Icon is SymbolIcon selectedIcon && MainSymbolIcon.Symbol != selectedIcon.Symbol)
|
|
// {
|
|
// MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
|
|
// }
|
|
//}
|
|
|
|
//_snowflake ??= new(MainCanvas);
|
|
//_snowflake.Start();
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|