初步添加一个主题配色,等待功能完善和测试
This commit is contained in:
@@ -91,6 +91,11 @@
|
||||
<materialDesign:PackIcon Kind="AccountConvert" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="主题色调" x:Name="MenuItem主题色调" Click="MenuItem主题色调_Click">
|
||||
<MenuItem.Icon>
|
||||
<materialDesign:PackIcon Kind="Palette" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
</MenuItem>
|
||||
<MenuItem Header="_关于">
|
||||
|
||||
@@ -297,6 +297,12 @@ namespace 软件系统客户端Wpf
|
||||
SoftUserPortrait.ChangePortrait();
|
||||
}
|
||||
|
||||
|
||||
private void MenuItem主题色调_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SetShowRenderControl(UIControl_Palette);
|
||||
}
|
||||
|
||||
private void MenuItem关于本软件_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
using (FormAbout fa = new FormAbout(Resource.StringResouce.SoftName,
|
||||
@@ -621,6 +627,8 @@ namespace 软件系统客户端Wpf
|
||||
private UserHome UIControl_Home { get; set; }
|
||||
|
||||
|
||||
private UserPaletteSelector UIControl_Palette { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 正在显示的子界面
|
||||
/// </summary>
|
||||
@@ -658,6 +666,11 @@ namespace 软件系统客户端Wpf
|
||||
|
||||
UIControl_Home = new UserHome();
|
||||
all_main_render.Add(UIControl_Home);
|
||||
|
||||
UIControl_Palette = new UserPaletteSelector();
|
||||
all_main_render.Add(UIControl_Palette);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void SetShowRenderControl(UserControl control)
|
||||
@@ -710,5 +723,7 @@ namespace 软件系统客户端Wpf
|
||||
{
|
||||
SetShowRenderControl(UIControl_Home);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
47
软件系统客户端Wpf/Views/Palette.xaml
Normal file
47
软件系统客户端Wpf/Views/Palette.xaml
Normal file
@@ -0,0 +1,47 @@
|
||||
<UserControl x:Class="软件系统客户端Wpf.Views.Palette"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:软件系统客户端Wpf.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="FontWeight" Value="DemiBold" />
|
||||
<Setter Property="Margin" Value="4" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height="1*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Background="{DynamicResource PrimaryHueMidBrush}" Grid.ColumnSpan="3">
|
||||
<TextBlock Foreground="{DynamicResource PrimaryHueMidForegroundBrush}">Primary - Mid</TextBlock>
|
||||
</Border>
|
||||
<Border Background="{DynamicResource PrimaryHueLightBrush}"
|
||||
Grid.Row="1">
|
||||
<TextBlock FontWeight="Bold" Foreground="{DynamicResource PrimaryHueLightForegroundBrush}">Light</TextBlock>
|
||||
</Border>
|
||||
<Border Background="{DynamicResource PrimaryHueMidBrush}"
|
||||
Grid.Row="1" Grid.Column="1">
|
||||
<TextBlock Foreground="{DynamicResource PrimaryHueMidForegroundBrush}">Mid</TextBlock>
|
||||
</Border>
|
||||
<Border Background="{DynamicResource PrimaryHueDarkBrush}"
|
||||
Grid.Row="1" Grid.Column="2">
|
||||
<TextBlock Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}">Dark</TextBlock>
|
||||
</Border>
|
||||
<Border Background="{DynamicResource SecondaryAccentBrush}"
|
||||
Grid.Row="2" Grid.ColumnSpan="3">
|
||||
<TextBlock Foreground="{DynamicResource SecondaryAccentForegroundBrush}">Accent</TextBlock>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
软件系统客户端Wpf/Views/Palette.xaml.cs
Normal file
28
软件系统客户端Wpf/Views/Palette.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace 软件系统客户端Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Palette.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class Palette : UserControl
|
||||
{
|
||||
public Palette()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
109
软件系统客户端Wpf/Views/UserPaletteSelector.xaml
Normal file
109
软件系统客户端Wpf/Views/UserPaletteSelector.xaml
Normal file
@@ -0,0 +1,109 @@
|
||||
<UserControl x:Class="软件系统客户端Wpf.Views.UserPaletteSelector"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesignColors="clr-namespace:MaterialDesignColors;assembly=MaterialDesignColors"
|
||||
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
|
||||
xmlns:local="clr-namespace:软件系统客户端Wpf.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="700" d:DesignWidth="400">
|
||||
<UserControl.Resources>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="CommandParameter" Value="{Binding}" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="{Binding ExemplarHue.Foreground, Mode=OneTime}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="PalettePath" TargetType="Path">
|
||||
<Setter Property="Data" Value="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z" />
|
||||
<Setter Property="Fill">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="{Binding ExemplarHue.Foreground, Mode=OneTime}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<DataTemplate DataType="{x:Type materialDesignColors:Swatch}">
|
||||
<wpf:Card Margin="2 2 6 6" Width="240">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding Name}" Margin="8" Grid.ColumnSpan="2" />
|
||||
<Border Grid.Row="1" Grid.Column="0" MinWidth="120">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="{Binding ExemplarHue.Color, Mode=OneTime}" />
|
||||
</Border.Background>
|
||||
<Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:UserPaletteSelector}}, Path=DataContext.ApplyPrimaryCommand, Mode=OneTime}"
|
||||
CommandParameter="{Binding}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Primary" />
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
<Path Style="{StaticResource PalettePath}" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Border>
|
||||
<Border Grid.Row="1" Grid.Column="1"
|
||||
Visibility="{Binding IsAccented, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneTime}"
|
||||
Width="120">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="{Binding AccentExemplarHue.Color, Mode=OneTime}" />
|
||||
</Border.Background>
|
||||
<Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:UserPaletteSelector}}, Path=DataContext.ApplyAccentCommand, Mode=OneTime}"
|
||||
CommandParameter="{Binding}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Accent" />
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
<Path Style="{StaticResource PalettePath}" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Border>
|
||||
</Grid>
|
||||
</wpf:Card>
|
||||
</DataTemplate>
|
||||
</UserControl.Resources>
|
||||
<DockPanel>
|
||||
<wpf:Card DockPanel.Dock="Top" Margin="2">
|
||||
<DockPanel>
|
||||
<local:Palette DockPanel.Dock="Left" Width="200" />
|
||||
<TextBlock Margin="16" TextWrapping="Wrap" VerticalAlignment="Center">This is your current palette. Configure your initial palette in App.xaml, but palettes can be changed at runtime.</TextBlock>
|
||||
</DockPanel>
|
||||
</wpf:Card>
|
||||
<Grid Margin="0 16 0 0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal" Margin="8">
|
||||
<TextBlock VerticalAlignment="Center">Light</TextBlock>
|
||||
<ToggleButton Margin="8 0 16 0" Command="{Binding ToggleBaseCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}" />
|
||||
<TextBlock VerticalAlignment="Center">Dark</TextBlock>
|
||||
</StackPanel>
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Margin="0 12 0 0">
|
||||
<ItemsControl ItemsSource="{Binding Swatches, Mode=OneTime}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
28
软件系统客户端Wpf/Views/UserPaletteSelector.xaml.cs
Normal file
28
软件系统客户端Wpf/Views/UserPaletteSelector.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace 软件系统客户端Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// UserPaletteSelector.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class UserPaletteSelector : UserControl
|
||||
{
|
||||
public UserPaletteSelector()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,12 +73,18 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Views\Palette.xaml.cs">
|
||||
<DependentUpon>Palette.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\UserChat.xaml.cs">
|
||||
<DependentUpon>UserChat.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\UserHome.xaml.cs">
|
||||
<DependentUpon>UserHome.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\UserPaletteSelector.xaml.cs">
|
||||
<DependentUpon>UserPaletteSelector.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="LoginWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -98,6 +104,10 @@
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Views\Palette.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\UserChat.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -106,6 +116,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\UserPaletteSelector.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
|
||||
Reference in New Issue
Block a user