整理控件库

This commit is contained in:
GG Z
2025-05-05 17:04:06 +08:00
parent 74532b77be
commit 3eaad7566e
283 changed files with 2156 additions and 17846 deletions

View File

@@ -3,86 +3,17 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using WPFluent.Controls;
using WPFluent.Gallery.Services.Contracts;
using WPFluent.Gallery.ViewModels.Windows;
using WPFluent.Gallery.Views.Pages;
namespace WPFluent.Gallery.Views.Windows;
public partial class MainWindow : IWindow
public partial class MainWindow
{
public MainWindow(
MainWindowViewModel viewModel,
INavigationService navigationService,
IServiceProvider serviceProvider,
ISnackbarService snackbarService,
IContentDialogService contentDialogService
)
public MainWindow()
{
//适应当前系统的主题
//Appearance.SystemThemeWatcher.Watch(this);
ViewModel = viewModel;
DataContext = this;
ViewModel = new MainWindowViewModel();
DataContext = ViewModel;
InitializeComponent();
snackbarService.SetSnackbarPresenter(SnackbarPresenter);
navigationService.SetNavigationControl(NavigationView);
contentDialogService.SetDialogHost(RootContentDialog);
}
public MainWindowViewModel ViewModel { get; }
private bool _isUserClosedPane;
private bool _isPaneOpenedOrClosedFromCode;
private void OnNavigationSelectionChanged(object sender, RoutedEventArgs e)
{
if (sender is not WPFluent.Controls.NavigationView navigationView)
{
return;
}
NavigationView.SetCurrentValue(
NavigationView.HeaderVisibilityProperty,
navigationView.SelectedItem?.TargetPageType != typeof(DashboardPage)
? Visibility.Visible
: Visibility.Collapsed
);
}
private void MainWindow_OnSizeChanged(object sender, SizeChangedEventArgs e)
{
if (_isUserClosedPane)
{
return;
}
_isPaneOpenedOrClosedFromCode = true;
NavigationView.SetCurrentValue(NavigationView.IsPaneOpenProperty, e.NewSize.Width > 1200);
_isPaneOpenedOrClosedFromCode = false;
}
private void NavigationView_OnPaneOpened(NavigationView sender, RoutedEventArgs args)
{
if (_isPaneOpenedOrClosedFromCode)
{
return;
}
_isUserClosedPane = false;
}
private void NavigationView_OnPaneClosed(NavigationView sender, RoutedEventArgs args)
{
if (_isPaneOpenedOrClosedFromCode)
{
return;
}
_isUserClosedPane = true;
}
}