更新客户端渲染,更新了壳
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<ui:FluentWindow
|
||||
x:Class="Wpf.Ui.Demo.Mvvm.Views.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Wpf.Ui.Demo.Mvvm.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tray="http://schemas.lepo.co/wpfui/2022/xaml/tray"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="{Binding ViewModel.ApplicationTitle, Mode=OneWay}"
|
||||
Width="1100"
|
||||
Height="650"
|
||||
d:DataContext="{d:DesignInstance local:MainWindow,
|
||||
IsDesignTimeCreatable=True}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
WindowBackdropType="Mica"
|
||||
WindowCornerPreference="Round"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d"
|
||||
>
|
||||
<ui:FluentWindow.InputBindings>
|
||||
<KeyBinding
|
||||
Key="F"
|
||||
Command="{Binding ElementName=AutoSuggestBox, Path=FocusCommand}"
|
||||
Modifiers="Control"
|
||||
/>
|
||||
</ui:FluentWindow.InputBindings>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ui:NavigationView
|
||||
x:Name="RootNavigation"
|
||||
Grid.Row="1"
|
||||
FooterMenuItemsSource="{Binding ViewModel.NavigationFooter, Mode=OneWay}"
|
||||
MenuItemsSource="{Binding ViewModel.NavigationItems, Mode=OneWay}"
|
||||
>
|
||||
<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.Header>
|
||||
<ui:BreadcrumbBar Margin="42,32,0,0" FontSize="28" FontWeight="DemiBold" />
|
||||
</ui:NavigationView.Header>
|
||||
</ui:NavigationView>
|
||||
<ui:TitleBar
|
||||
Title="{Binding ViewModel.ApplicationTitle, Mode=OneWay}"
|
||||
Grid.Row="0"
|
||||
Icon="pack://application:,,,/Assets/applicationIcon-256.png"
|
||||
/>
|
||||
<tray:NotifyIcon
|
||||
Grid.Row="0"
|
||||
FocusOnLeftClick="True"
|
||||
Icon="pack://application:,,,/Assets/applicationIcon-256.png"
|
||||
MenuOnRightClick="True"
|
||||
TooltipText="WPF UI - MVVM Demo"
|
||||
>
|
||||
<tray:NotifyIcon.Menu>
|
||||
<ContextMenu ItemsSource="{Binding ViewModel.TrayMenuItems, Mode=OneWay}" />
|
||||
</tray:NotifyIcon.Menu>
|
||||
</tray:NotifyIcon>
|
||||
</Grid>
|
||||
</ui:FluentWindow>
|
||||
@@ -0,0 +1,61 @@
|
||||
// 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 Wpf.Ui.Abstractions;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace Wpf.Ui.Demo.Mvvm.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : INavigationWindow
|
||||
{
|
||||
public ViewModels.MainWindowViewModel ViewModel { get; }
|
||||
|
||||
public MainWindow(ViewModels.MainWindowViewModel viewModel, INavigationService navigationService)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = this;
|
||||
|
||||
Appearance.SystemThemeWatcher.Watch(this);
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
navigationService.SetNavigationControl(RootNavigation);
|
||||
}
|
||||
|
||||
public INavigationView GetNavigation() => RootNavigation;
|
||||
|
||||
public bool Navigate(Type pageType) => RootNavigation.Navigate(pageType);
|
||||
|
||||
public void SetPageService(INavigationViewPageProvider navigationViewPageProvider) =>
|
||||
RootNavigation.SetPageProviderService(navigationViewPageProvider);
|
||||
|
||||
public void ShowWindow() => Show();
|
||||
|
||||
public void CloseWindow() => Close();
|
||||
|
||||
/// <summary>
|
||||
/// Raises the closed event.
|
||||
/// </summary>
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
|
||||
// Make sure that closing this window will begin the process of closing the application.
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
INavigationView INavigationWindow.GetNavigation()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetServiceProvider(IServiceProvider serviceProvider)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<Page
|
||||
x:Class="Wpf.Ui.Demo.Mvvm.Views.Pages.DashboardPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Wpf.Ui.Demo.Mvvm.Views.Pages"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="DashboardPage"
|
||||
d:DataContext="{d:DesignInstance local:DashboardPage,
|
||||
IsDesignTimeCreatable=False}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
mc:Ignorable="d"
|
||||
>
|
||||
<Grid Margin="42" VerticalAlignment="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:Button
|
||||
Grid.Column="0"
|
||||
Command="{Binding ViewModel.CounterIncrementCommand, Mode=OneWay}"
|
||||
Content="Click me!"
|
||||
Icon="{ui:SymbolIcon Fluent24}"
|
||||
/>
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="12,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding ViewModel.Counter, Mode=OneWay}"
|
||||
/>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,24 @@
|
||||
// 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 Wpf.Ui.Abstractions.Controls;
|
||||
|
||||
namespace Wpf.Ui.Demo.Mvvm.Views.Pages;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for DashboardPage.xaml
|
||||
/// </summary>
|
||||
public partial class DashboardPage : INavigableView<ViewModels.DashboardViewModel>
|
||||
{
|
||||
public ViewModels.DashboardViewModel ViewModel { get; }
|
||||
|
||||
public DashboardPage(ViewModels.DashboardViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = this;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<Page
|
||||
x:Class="Wpf.Ui.Demo.Mvvm.Views.Pages.DataPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Wpf.Ui.Demo.Mvvm.Views.Pages"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:models="clr-namespace:Wpf.Ui.Demo.Mvvm.Models"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="DataPage"
|
||||
d:DataContext="{d:DesignInstance local:DataPage,
|
||||
IsDesignTimeCreatable=False}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
ScrollViewer.CanContentScroll="False"
|
||||
mc:Ignorable="d"
|
||||
>
|
||||
<Grid Margin="42">
|
||||
<ui:VirtualizingItemsControl
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
ItemsSource="{Binding ViewModel.Colors, Mode=OneWay}"
|
||||
VirtualizingPanel.CacheLengthUnit="Item"
|
||||
>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type models:DataColor}">
|
||||
<ui:Button
|
||||
Width="80"
|
||||
Height="80"
|
||||
Margin="2"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Appearance="Secondary"
|
||||
Background="{Binding Color, Mode=OneWay}"
|
||||
FontSize="25"
|
||||
Icon="Fluent24"
|
||||
/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ui:VirtualizingItemsControl>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,24 @@
|
||||
// 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 Wpf.Ui.Abstractions.Controls;
|
||||
|
||||
namespace Wpf.Ui.Demo.Mvvm.Views.Pages;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for DataView.xaml
|
||||
/// </summary>
|
||||
public partial class DataPage : INavigableView<ViewModels.DataViewModel>
|
||||
{
|
||||
public ViewModels.DataViewModel ViewModel { get; }
|
||||
|
||||
public DataPage(ViewModels.DataViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = this;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<Page
|
||||
x:Class="Wpf.Ui.Demo.Mvvm.Views.Pages.SettingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:helpers="clr-namespace:Wpf.Ui.Demo.Mvvm.Helpers"
|
||||
xmlns:local="clr-namespace:Wpf.Ui.Demo.Mvvm.Views.Pages"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="SettingsPage"
|
||||
d:DataContext="{d:DesignInstance local:SettingsPage,
|
||||
IsDesignTimeCreatable=False}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
mc:Ignorable="d"
|
||||
>
|
||||
<Page.Resources>
|
||||
<helpers:EnumToBooleanConverter x:Key="EnumToBooleanConverter" />
|
||||
</Page.Resources>
|
||||
<StackPanel Margin="42">
|
||||
<TextBlock FontSize="20" FontWeight="Medium" Text="Personalization" />
|
||||
<TextBlock Margin="0,12,0,0" Text="Theme" />
|
||||
<RadioButton
|
||||
Margin="0,12,0,0"
|
||||
Command="{Binding ViewModel.ChangeThemeCommand, Mode=OneWay}"
|
||||
CommandParameter="theme_light"
|
||||
Content="Light"
|
||||
GroupName="themeSelect"
|
||||
IsChecked="{Binding ViewModel.CurrentApplicationTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Light, Mode=OneWay}"
|
||||
/>
|
||||
<RadioButton
|
||||
Margin="0,8,0,0"
|
||||
Command="{Binding ViewModel.ChangeThemeCommand, Mode=OneWay}"
|
||||
CommandParameter="theme_dark"
|
||||
Content="Dark"
|
||||
GroupName="themeSelect"
|
||||
IsChecked="{Binding ViewModel.CurrentApplicationTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Dark, Mode=OneWay}"
|
||||
/>
|
||||
<TextBlock Margin="0,24,0,0" FontSize="20" FontWeight="Medium" Text="About Wpf.Ui.Demo.Mvvm" />
|
||||
<TextBlock Margin="0,12,0,0" Text="{Binding ViewModel.AppVersion, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
</Page>
|
||||
@@ -0,0 +1,24 @@
|
||||
// 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 Wpf.Ui.Abstractions.Controls;
|
||||
|
||||
namespace Wpf.Ui.Demo.Mvvm.Views.Pages;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for SettingsPage.xaml
|
||||
/// </summary>
|
||||
public partial class SettingsPage : INavigableView<ViewModels.SettingsViewModel>
|
||||
{
|
||||
public ViewModels.SettingsViewModel ViewModel { get; }
|
||||
|
||||
public SettingsPage(ViewModels.SettingsViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = this;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user