整理控件库
This commit is contained in:
@@ -9,50 +9,15 @@ using TextViewModel = WPFluent.Gallery.ViewModels.Pages.TextViewModel;
|
||||
|
||||
namespace WPFluent.Gallery.Views;
|
||||
|
||||
public partial class TextPage : INavigableView<TextViewModel>
|
||||
public partial class TextPage
|
||||
{
|
||||
private readonly INavigationService _navigationService;
|
||||
|
||||
|
||||
public TextViewModel ViewModel { get; }
|
||||
|
||||
public TextPage(TextViewModel viewModel, INavigationService navigationService)
|
||||
public TextPage()
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = this;
|
||||
_navigationService = navigationService;
|
||||
ViewModel = new TextViewModel();
|
||||
DataContext = ViewModel;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user