更新整理

This commit is contained in:
GG Z
2025-04-24 20:56:44 +08:00
parent 155cef46f8
commit 5b6d67b571
813 changed files with 14437 additions and 12362 deletions

View File

@@ -0,0 +1,61 @@
<wpf:FluentWindow
Height="450"
Title="FluentWindowDemo"
Width="800"
mc:Ignorable="d"
x:Class="WPFluent.Gallery.Views.Windows.FluentWindowDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPFluent.Gallery.Views.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="https://github.com/ShrlAlgo/WPFluent"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StatusBar
Grid.Row="2"
Margin="0"
MinHeight="0"
Padding="8,2"
x:Name="RootStatusBar">
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem>
<wpf:SymbolIcon Foreground="{DynamicResource TextFillColorSecondaryBrush}" Symbol="BranchFork24" />
</StatusBarItem>
<StatusBarItem Grid.Column="1" Margin="0,0,4,0">
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}" Text="Development *" />
</StatusBarItem>
<StatusBarItem Grid.Column="2" Margin="4,0,4,0">
<wpf:SymbolIcon Foreground="{DynamicResource TextFillColorSecondaryBrush}" Symbol="Home24" />
</StatusBarItem>
<StatusBarItem Grid.Column="3" Margin="4,0,4,0">
<wpf:SymbolIcon Foreground="{DynamicResource TextFillColorSecondaryBrush}" Symbol="Fire24" />
</StatusBarItem>
<StatusBarItem Grid.Column="4" Margin="4,0,4,0">
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}" Text="WPFluent.sln" />
</StatusBarItem>
<StatusBarItem Grid.Column="6">
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}" Text="Ln 45, Col 30 Spaces: 2 UTF8 with BOM C#" />
</StatusBarItem>
</StatusBar>
</Grid>
</wpf:FluentWindow>

View File

@@ -0,0 +1,9 @@
namespace WPFluent.Gallery.Views.Windows;
public partial class FluentWindowDemo
{
public FluentWindowDemo()
{
InitializeComponent();
}
}

View File

@@ -0,0 +1,105 @@
<ui:FluentWindow
x:Class="WPFluent.Gallery.Views.Windows.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFluent.Gallery.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i18n="http://schemas.lepo.co/i18n/2022/xaml"
xmlns:local="clr-namespace:WPFluent.Gallery.Views.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tray="https://github.com/ShrlAlgo/WPFluent/tray"
xmlns:ui="https://github.com/ShrlAlgo/WPFluent"
Title="{Binding ViewModel.ApplicationTitle, Mode=OneWay}"
Width="1450"
Height="802"
MinWidth="900"
d:DataContext="{d:DesignInstance local:MainWindow,
IsDesignTimeCreatable=False}"
d:DesignHeight="650"
d:DesignWidth="1000"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
ExtendsContentIntoTitleBar="True"
SizeChanged="MainWindow_OnSizeChanged"
WindowBackdropType="Mica"
WindowCornerPreference="Default"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<ui:FluentWindow.InputBindings>
<KeyBinding
Key="F"
Command="{Binding ElementName=AutoSuggestBox, Path=FocusCommand}"
Modifiers="Control" />
</ui:FluentWindow.InputBindings>
<!--<ui:FluentWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary Theme="Light" />
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</ui:FluentWindow.Resources>-->
<Grid>
<ui:NavigationView
x:Name="NavigationView"
Padding="42,0,42,0"
BreadcrumbBar="{Binding ElementName=BreadcrumbBar}"
EnableDebugMessages="True"
FooterMenuItemsSource="{Binding ViewModel.FooterMenuItems, Mode=OneWay}"
FrameMargin="0"
IsBackButtonVisible="Visible"
IsPaneToggleVisible="True"
MenuItemsSource="{Binding ViewModel.MenuItems, Mode=OneWay}"
OpenPaneLength="310"
PaneClosed="NavigationView_OnPaneClosed"
PaneDisplayMode="Left"
PaneOpened="NavigationView_OnPaneOpened"
SelectionChanged="OnNavigationSelectionChanged"
TitleBar="{Binding ElementName=TitleBar, Mode=OneWay}"
Transition="FadeInWithSlide">
<ui:NavigationView.Header>
<StackPanel Margin="42,32,42,20">
<ui:BreadcrumbBar x:Name="BreadcrumbBar" />
<controls:PageControlDocumentation Margin="0,10,0,0" NavigationView="{Binding ElementName=NavigationView}" />
</StackPanel>
</ui:NavigationView.Header>
<ui:NavigationView.AutoSuggestBox>
<ui:AutoSuggestBox x:Name="AutoSuggestBox" PlaceholderText="Search">
<ui:AutoSuggestBox.Icon>
<ui:IconSourceElement>
<ui:SymbolIconSource Symbol="Search24" />
</ui:IconSourceElement>
</ui:AutoSuggestBox.Icon>
</ui:AutoSuggestBox>
</ui:NavigationView.AutoSuggestBox>
<ui:NavigationView.ContentOverlay>
<Grid>
<ui:SnackbarPresenter x:Name="SnackbarPresenter" />
</Grid>
</ui:NavigationView.ContentOverlay>
</ui:NavigationView>
<ContentPresenter x:Name="RootContentDialog" Grid.Row="0" />
<ui:TitleBar
x:Name="TitleBar"
Title="{Binding ViewModel.ApplicationTitle}"
Grid.Row="0"
CloseWindowByDoubleClickOnIcon="True">
<ui:TitleBar.Icon>
<ui:ImageIcon Source="pack://application:,,,/WPFluent.Gallery;component/wpfui.png" />
</ui:TitleBar.Icon>
</ui:TitleBar>
<!--<tray:NotifyIcon
Grid.Row="0"
FocusOnLeftClick="True"
Icon="pack://application:,,,/WPFluent.Gallery;component/wpfui.png"
MenuOnRightClick="True"
TooltipText="WPF UI Gallery">
<tray:NotifyIcon.Menu>
<ContextMenu ItemsSource="{Binding ViewModel.TrayMenuItems, Mode=OneWay}" />
</tray:NotifyIcon.Menu>
</tray:NotifyIcon>-->
</Grid>
</ui:FluentWindow>

View File

@@ -0,0 +1,88 @@
// 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 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 MainWindow(
MainWindowViewModel viewModel,
INavigationService navigationService,
IServiceProvider serviceProvider,
ISnackbarService snackbarService,
IContentDialogService contentDialogService
)
{
//适应当前系统的主题
//Appearance.SystemThemeWatcher.Watch(this);
ViewModel = viewModel;
DataContext = this;
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;
}
}