This commit is contained in:
GG Z
2025-07-31 20:12:24 +08:00
parent 4f6cd2137c
commit f209e7d3ad
426 changed files with 15854 additions and 6612 deletions

View File

@@ -0,0 +1,21 @@
<Application
StartupUri="MainWindow.xaml"
x:Class="NeuWPFTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:enu="https://github.com/ShrlAlgo/LucentUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- <enu:ThemesDictionary Theme="Dark" /> -->
<!-- <enu:ControlsDictionary /> -->
<!-- <ResourceDictionary Source="pack://application:,,,/LucentUI;component/Themes/Light.xaml" /> -->
<ResourceDictionary Source="pack://application:,,,/NeuWPF;component/Themes/Dark.xaml" />
<ResourceDictionary Source="pack://application:,,,/NeuWPF;component/Themes/Styles.xaml" />
<!-- <ResourceDictionary Source="pack://application:,,,/LucentUI;component/Themes/Extra.xaml" /> -->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using NeuWPF;
namespace NeuWPFTest
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
//protected override void OnStartup(StartupEventArgs e)
//{
// base.OnStartup(e);
// // 在应用启动时,调用方法打印所有已加载的资源字典
// Debug.WriteLine("==========================================================");
// Debug.WriteLine(" Dumping All Loaded Application Resource Dictionaries... ");
// Debug.WriteLine("==========================================================");
// // 从最顶层的 Application.Resources 开始遍历
// DumpResourceDictionaries(Application.Current.Resources, 0);
// Debug.WriteLine("====================== End of Dump =======================");
//}
/// <summary>
/// 递归打印资源字典及其合并的子字典。
/// </summary>
/// <param name="dictionary">要检查的资源字典。</param>
/// <param name="indentationLevel">缩进级别,用于格式化输出。</param>
private void DumpResourceDictionaries(ResourceDictionary dictionary, int indentationLevel)
{
// 创建缩进字符串,使输出更具可读性
var indent = new string(' ', indentationLevel * 4);
// 打印当前字典的来源Source URI
// App.xaml 中直接定义的根 ResourceDictionary 没有 Source所以需要判断
if (dictionary.Source != null)
{
Debug.WriteLine($"{indent}-> Source: {dictionary.Source}");
}
else
{
// 这是根字典或一个内联定义的字典
Debug.WriteLine($"{indent}[Root or Inline Dictionary]");
}
// 递归遍历所有合并的字典
foreach (var mergedDict in dictionary.MergedDictionaries)
{
DumpResourceDictionaries(mergedDict, indentationLevel + 1);
}
}
}
}

View File

@@ -0,0 +1,378 @@
<Window x:Class="NeuWPFTest.ControlTestWindow"
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:lu="https://github.com/ShrlAlgo/NeuWPF"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Width="800"
d:SizeToContent="WidthAndHeight"
Height="600"
d:Height="1200"
mc:Ignorable="d"
Icon="/Resources/Images/SyminUI.png"
Style="{StaticResource Window.Normal}"
Title="Custom Control Test">
<!-- 主窗口背景色,这是拟态风格的基础 -->
<Window.Resources>
<!-- 定义拟态按钮样式 -->
<Style x:Key="NeumorphicButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#e0e5ec" />
<Setter Property="Foreground" Value="#707070" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="20,10" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<!-- 控件主体,包含两个阴影效果 -->
<Border x:Name="shadowDark"
Background="{TemplateBinding Background}"
CornerRadius="12">
<Border.Effect>
<DropShadowEffect ShadowDepth="4" Direction="315" Color="#a3b1c6" Opacity="0.7" BlurRadius="5"/>
</Border.Effect>
</Border>
<Border Background="{TemplateBinding Background}" CornerRadius="12" x:Name="shadowLight">
<Border.Effect>
<DropShadowEffect ShadowDepth="-4" Direction="135" Color="#ffffff" Opacity="1" BlurRadius="5"/>
</Border.Effect>
</Border>
<!-- 按钮内容 -->
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
<!-- 按下时的内阴影效果 (通过渐变模拟) -->
<Border x:Name="insetBorder" CornerRadius="12" Opacity="0">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="#a3b1c6" Offset="0"/>
<GradientStop Color="#ffffff" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
</Border>
</Grid>
<ControlTemplate.Triggers>
<!-- 鼠标按下时的触发器 -->
<Trigger Property="IsPressed" Value="True">
<!-- 隐藏外阴影 -->
<Setter TargetName="shadowDark" Property="Opacity" Value="0" />
<Setter TargetName="shadowLight" Property="Opacity" Value="0" />
<!-- 显示内阴影 -->
<Setter TargetName="insetBorder" Property="Opacity" Value="0.3" />
<!-- 轻微移动内容,模拟按压感 -->
<Setter Property="RenderTransform">
<Setter.Value>
<TranslateTransform X="1" Y="1"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 基础颜色定义 -->
<!-- 修正点:将 Color 改为 SolidColorBrush -->
<SolidColorBrush x:Key="BackgroundColor" Color="#e0e5ec" />
<SolidColorBrush x:Key="TextColor" Color="#7a7e85" />
<!-- 以下定义为 Color 是正确的,因为它们被用于 DropShadowEffect 和 GradientStop -->
<Color x:Key="DarkShadowColor">#a3b1c6</Color>
<Color x:Key="LightShadowColor">#ffffff</Color>
<Color x:Key="LightGradientColor">#ebeff5</Color>
<Color x:Key="DarkGradientColor">#d1d9e6</Color>
<!-- 优化后的拟态按钮样式 -->
<Style x:Key="AdvancedNeumorphicButtonStyle" TargetType="Button">
<Setter Property="Width" Value="180" />
<Setter Property="Height" Value="60" />
<!-- 修正点:现在可以正确引用 TextColor 这个 Brush 了 -->
<Setter Property="Foreground" Value="{StaticResource TextColor}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<!-- 暗阴影 (右下方) -->
<Border CornerRadius="20" Background="{StaticResource BackgroundColor}">
<Border.Effect>
<DropShadowEffect ShadowDepth="4" Direction="315" Color="{StaticResource DarkShadowColor}" Opacity="0.5" BlurRadius="8" />
</Border.Effect>
</Border>
<!-- 亮阴影 (左上方) -->
<Border CornerRadius="20" Background="{StaticResource BackgroundColor}">
<Border.Effect>
<DropShadowEffect ShadowDepth="-4" Direction="135" Color="{StaticResource LightShadowColor}" Opacity="0.9" BlurRadius="8" />
</Border.Effect>
</Border>
<!-- 按钮内容层 -->
<Border x:Name="ContentBorder" CornerRadius="20">
<!-- 使用渐变背景来营造立体感 -->
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="{StaticResource LightGradientColor}" Offset="0" />
<GradientStop Color="{StaticResource DarkGradientColor}" Offset="1" />
</LinearGradientBrush>
</Border.Background>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<!-- 这里也可以直接用颜色字符串WPF会自动转换 -->
<Setter Property="Foreground" Value="#3498db" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="ContentBorder" Property="Background">
<Setter.Value>
<!-- 反向渐变模拟凹陷 -->
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="{StaticResource DarkGradientColor}" Offset="0" />
<GradientStop Color="{StaticResource LightGradientColor}" Offset="1" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
<!-- 按下时清除外部阴影,让凹陷效果更纯粹 -->
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="0" BlurRadius="0" Opacity="0" Color="Transparent"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 定义画刷和颜色资源 -->
<SolidColorBrush x:Key="ButtonBackground" Color="#ebebeb" />
<SolidColorBrush x:Key="ButtonForeground" Color="#4181f098" />
<SolidColorBrush x:Key="ButtonForegroundHover" Color="#357af0" />
<SolidColorBrush x:Key="ButtonBorderBrush" Color="#1fffffff" />
<!-- Hover 状态的渐变背景 -->
<LinearGradientBrush x:Key="ButtonBackgroundHover" StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="#d4d4d4" Offset="0.0" />
<GradientStop Color="#fbfbfb" Offset="1.0" />
</LinearGradientBrush>
<!-- 从 CSS 转换的按钮样式 -->
<Style x:Key="CssInspiredButtonStyle" TargetType="Button">
<Setter Property="FontSize" Value="17" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Padding" Value="16,8" />
<Setter Property="Foreground" Value="{StaticResource ButtonForeground}" />
<!-- 错误已移除: CharacterSpacing Setter 不能在这里 -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="RootGrid">
<!-- 暗阴影 (右下方) -->
<Border x:Name="DarkShadow" CornerRadius="20" Background="{StaticResource ButtonBackground}">
<Border.Effect>
<DropShadowEffect ShadowDepth="5" Direction="315" Color="{StaticResource DarkShadowColor}" Opacity="1" BlurRadius="15"/>
</Border.Effect>
</Border>
<!-- 亮阴影 (左上方) -->
<Border x:Name="LightShadow" CornerRadius="20" Background="{StaticResource ButtonBackground}">
<Border.Effect>
<DropShadowEffect ShadowDepth="5" Direction="135" Color="{StaticResource LightShadowColor}" Opacity="1" BlurRadius="15"/>
</Border.Effect>
</Border>
<!-- 按钮主体和内容 -->
<Border x:Name="ContentBorder"
CornerRadius="20"
Background="{TemplateBinding Background}"
BorderBrush="{StaticResource ButtonBorderBrush}"
BorderThickness="1">
<!--
修正点:将 CharacterSpacing 直接设置在 ContentPresenter 上
同时移除了 Converter
-->
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<!-- Hover 状态 -->
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{StaticResource ButtonForegroundHover}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{StaticResource ButtonBackgroundHover}" />
</Trigger>
<!-- Active (Pressed) 状态 -->
<Trigger Property="IsPressed" Value="True">
<Setter Property="Foreground" Value="{StaticResource ButtonForegroundHover}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{StaticResource ButtonBackground}" />
<!-- 模拟 inset shadow -->
<Setter TargetName="DarkShadow" Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="4" Direction="135" Color="{StaticResource DarkShadowColor}" Opacity="1" BlurRadius="15"/>
</Setter.Value>
</Setter>
<Setter TargetName="LightShadow" Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="4" Direction="315" Color="{StaticResource LightShadowColor}" Opacity="1" BlurRadius="15"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Background" Value="{StaticResource ButtonBackground}" />
</Style>
</Window.Resources>
<lu:WindowAssist.TitleBar>
<Menu>
<MenuItem Header="Help">
<MenuItem Header="About" />
</MenuItem>
</Menu>
</lu:WindowAssist.TitleBar>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 直接使用 Anchor 作为容器 -->
<lu:Anchor Grid.ColumnSpan="2">
<!-- 将您之前放在ScrollViewer里的内容直接作为Anchor的内容 -->
<StackPanel Margin="20">
<!-- 第一个锚点 -->
<Grid Height="400"
Margin="10"
Background="#C7CEE0"
lu:AnchorAssist.AnchorName="简介">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="24"
FontWeight="Bold"
Text="简介部分" />
</Grid>
<!-- 第二个锚点 -->
<Grid Height="500"
Margin="10"
Background="#B8C0D0"
lu:AnchorAssist.AnchorName="功能特性">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="24"
FontWeight="Bold"
Text="功能特性部分" />
</Grid>
<!-- 第三个锚点 -->
<Border Height="600"
Margin="10"
Background="#A9B2C0"
CornerRadius="10"
lu:AnchorAssist.AnchorName="API文档">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="24"
FontWeight="Bold"
Text="API文档部分" />
</Border>
<!-- 第四个锚点 -->
<Border Height="300"
Margin="10"
Background="#9FA8B6"
CornerRadius="10"
lu:AnchorAssist.AnchorName="联系我们">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="24"
FontWeight="Bold"
Text="联系我们部分" />
</Border>
</StackPanel>
</lu:Anchor>
<ScrollViewer Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2">
<Grid Background="{StaticResource Background.Main}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<lu:PropertyField Grid.Row="0"
Margin="6,0"
PropertyName="属性"
PropertyValue="123" />
<lu:PropertyField Grid.Row="1"
Margin="6,0"
PropertyName="属性x"
PropertyValue="154" />
<lu:EditableTreeView x:Name="myTreeView" Grid.Row="2">
<lu:EditableTreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding ItemName}" />
<Button Content="按钮" />
</StackPanel>
</HierarchicalDataTemplate>
</lu:EditableTreeView.ItemTemplate>
</lu:EditableTreeView>
<TreeView x:Name="OldTreeView" Grid.Row="3">
<TreeView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ItemName}" />
</DataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<TreeViewItem Grid.Row="4" Header="TreeItem" />
<ItemsControl x:Name="testItemsControl" Grid.Row="5" />
<UniformGrid Grid.Row="6" Margin="30">
<Button
Content="Button"
Style="{StaticResource NeumorphicButtonStyle}" />
<Button
Content="Button"
Style="{StaticResource AdvancedNeumorphicButtonStyle}" />
<Button
Content="Button"
Style="{StaticResource CssInspiredButtonStyle}" />
<Button
Content="Button"
Style="{StaticResource NeumorphismStyle_light}" />
<Button
Content="Button"
Style="{StaticResource NeumorphismStyle_light2}" />
<Button
Content="Button"
Style="{StaticResource NeumorphismStyle_dark}" />
</UniformGrid>
</Grid>
</ScrollViewer>
</Grid>
</Window>

View File

@@ -0,0 +1,50 @@
using System.Collections.Generic;
using System.Windows;
namespace NeuWPFTest
{
/// <summary>
/// ControlTestWindow.xaml 的交互逻辑
/// </summary>
public partial class ControlTestWindow : Window
{
public ControlTestWindow()
{
InitializeComponent();
SetViewData();
SetItemsData();
}
private void SetViewData()
{
var i1 = new TreeData("1111");
i1.Children = new List<TreeData>
{
new TreeData("AAA"),
new TreeData("BBB")
};
List<TreeData> datalist = new()
{
i1,
new TreeData("2222"),
new TreeData("3333")
};
myTreeView.ItemsSource = datalist;
OldTreeView.ItemsSource = datalist;
}
private void SetItemsData()
{
}
}
public class TreeData
{
public TreeData(string name)
{
ItemName = name;
}
public string ItemName { get; set; }
public List<TreeData> Children { get; set; } = new List<TreeData>();
}
}

View File

@@ -0,0 +1,63 @@
using System.Collections.ObjectModel;
namespace NeuWPFTest.DataModel
{
public enum Gender
{
Male,
Female,
Other
}
public class DataGridItem
{
public int Id { get; set; }
public string Name { get; set; } = "";
public int Age { get; set; }
public bool Mark { get; set; }
public Gender Gender { get; set; }
}
public class DataGridDemo
{
public ObservableCollection<DataGridItem> DataCollection { get; set; } =
[
new DataGridItem
{
Id = 0,
Name = "Symin",
Age = 24,
Mark = true,
Gender = Gender.Other,
},
new DataGridItem
{
Id = 1,
Name = "Mike",
Age = 23,
Mark = false,
Gender = Gender.Male,
},
new DataGridItem
{
Id = 2,
Name = "Alice",
Age = 25,
Mark = true,
Gender = Gender.Female,
},
new DataGridItem
{
Id = 3,
Name = "Bob",
Age = 18,
Mark = true,
Gender = Gender.Male,
}
];
}
}

View File

@@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace NeuWPFTest.DataModel
{
public class TreeItemData
{
public string Content { get; set; } = "123";
public List<TreeItemData> Children { get; set; } = [];
}
}

View File

@@ -0,0 +1,371 @@
<Window x:Class="NeuWPFTest.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:dm="clr-namespace:NeuWPFTest.DataModel"
xmlns:enu="https://github.com/ShrlAlgo/NeuWPF"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Width="1000"
Height="800"
mc:Ignorable="d"
d:Height="Auto"
d:SizeToContent="WidthAndHeight"
Icon="/Resources/Images/SyminUI.png"
Loaded="Window_Loaded"
Selector.SelectionChanged="TabControl_SelectionChanged"
Style="{StaticResource Window.Normal}"
Title="样式示例"
WindowStartupLocation="CenterScreen">
<enu:WindowAssist.TitleBar>
<!-- <Grid VerticalAlignment="Center"> -->
<!-- <Grid.ColumnDefinitions> -->
<!-- <ColumnDefinition /> -->
<!-- <ColumnDefinition Width="Auto" /> -->
<!-- </Grid.ColumnDefinitions> -->
<!-- -->
<!-- <Button -->
<!-- Content="切换主题" -->
<!-- Grid.Column="1" -->
<!-- VerticalAlignment="Center" /> -->
<!-- </Grid> -->
<Menu>
<MenuItem Header="文件">
<MenuItem Header="打开" />
<MenuItem Header="打开最近文件...">
<MenuItem Header="文件01" />
<MenuItem Header="文件02" />
<MenuItem Header="文件03" />
</MenuItem>
<Separator />
<MenuItem Header="保存" />
<MenuItem Header="另存为..." />
</MenuItem>
<MenuItem Header="编辑">
<MenuItem Header="删除" />
<MenuItem Header="编辑模式"
IsCheckable="True"
IsChecked="True" />
</MenuItem>
<MenuItem Header="复选"
IsCheckable="True"
IsChecked="True" />
<MenuItem Header="帮助">
<MenuItem Header="关于" />
</MenuItem>
</Menu>
</enu:WindowAssist.TitleBar>
<Window.Resources>
<ResourceDictionary>
<!-- <ResourceDictionary.MergedDictionaries> -->
<!-- <enu:ThemesDictionary Theme="Dark" /> -->
<!-- <enu:ControlsDictionary /> -->
<!-- </ResourceDictionary.MergedDictionaries> -->
<dm:DataGridDemo x:Key="Dgd" />
<ContextMenu x:Key="ContextMenuDemo">
<MenuItem Header="菜单01" />
<MenuItem Header="菜单02" />
<Separator />
<MenuItem Header="菜单03">
<MenuItem Header="菜单A1" />
<MenuItem Header="菜单A2" />
<Separator />
<MenuItem Header="菜单A3" />
</MenuItem>
</ContextMenu>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="24" />
</Grid.RowDefinitions>
<!-- 工具栏 -->
<ToolBarTray Margin="4,4,4,0">
<ToolBar Foreground="{DynamicResource Primary.Focused}" Header="工具栏">
<Button Click="Switch_OnClick" Content="切换主题" />
<ToggleButton Content="切换" />
<Separator />
<RadioButton Content="单选框A" IsChecked="True" />
<RadioButton Content="单选框B" />
<TextBox Width="100" Text="文本框" />
<CheckBox Content="复选框" />
<Separator />
<ComboBox Width="100" SelectedIndex="0">
<ComboBoxItem Content="选项01" />
<ComboBoxItem Content="选项02" />
<ComboBoxItem Content="选项03" />
</ComboBox>
</ToolBar>
<ToolBar Foreground="{DynamicResource Primary.Focused}" Header="工具栏">
<ToggleButton Content="切换" />
<Button x:Name="Test"
Click="Test_OnClick"
Content="测试" />
</ToolBar>
</ToolBarTray>
<!-- 中间部分 -->
<enu:Anchor Grid.Row="1" Margin="4">
<StackPanel>
<StackPanel>
<GroupBox enu:AnchorAssist.AnchorName="装饰器" Header="装饰器">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<enu:SlotBorder Height="100"
Margin="5"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="凹槽"
FontSize="24"
Foreground="{DynamicResource Gradient.Primary}"
Radius="16" />
<enu:EmbossBorder Grid.Column="1"
Margin="5"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="浮雕"
ContextMenu="{StaticResource ContextMenuDemo}"
CornerRadius="16"
FontSize="24"
Foreground="{DynamicResource Gradient.Primary}"
ToolTip="右键" />
<enu:Card Grid.Column="2"
Margin="5"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="卡片"
CornerRadius="16"
FontSize="24"
Foreground="{DynamicResource Gradient.Primary}" />
<enu:LightedSurface Grid.Row="1"
Grid.ColumnSpan="3"
Height="100"
Margin="5"
Background="{DynamicResource Background.Main}"
Content="在此处移动鼠标"
CornerRadius="16"
FontSize="24" />
</Grid>
</GroupBox>
<GroupBox enu:AnchorAssist.AnchorName="按钮和标签" Header="按钮和标签">
<StackPanel Orientation="Horizontal">
<Button Content="基本按钮" />
<Button Content="主要按钮" Style="{StaticResource ButtonPrimary}" />
<Button Content="禁用基本按钮" IsEnabled="False" />
<Button Content="禁用主要按钮"
IsEnabled="False"
Style="{StaticResource ButtonPrimary}" />
<Separator />
</StackPanel>
</GroupBox>
<GroupBox enu:AnchorAssist.AnchorName="文本框" Header="文本框">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBox VerticalAlignment="Center" Text="文本框(输入字段)" />
<PasswordBox Grid.Row="1"
Grid.Column="0"
Password="12345" />
<RichTextBox Grid.Row="2">
<FlowDocument>
<Paragraph>
<Bold>Flow Document</Bold>
in a
<Run Foreground="{StaticResource Gradient.Primary}">富文本框.</Run>
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
</GroupBox>
<GroupBox enu:AnchorAssist.AnchorName="下拉框" Header="下拉框">
<StackPanel Orientation="Horizontal">
<ComboBox Grid.Row="1"
Grid.Column="0"
IsEditable="True"
SelectedIndex="0">
<ComboBoxItem Content="可编辑 选项" />
<ComboBoxItem Content="选项 B" />
<ComboBoxItem Content="选项 C" />
</ComboBox>
<ComboBox SelectedIndex="0">
<ComboBoxItem Content="选项 A" />
<ComboBoxItem Content="选项 B" />
<ComboBoxItem Content="选项 C" />
</ComboBox>
</StackPanel>
</GroupBox>
<GroupBox enu:AnchorAssist.AnchorName="切换按钮" Header="切换按钮">
<UniformGrid Rows="1">
<ToggleButton Grid.Row="0"
Grid.Column="0"
Content="切换按钮"
IsChecked="True" />
<ToggleButton Grid.Row="0"
Grid.Column="1"
IsChecked="True"
Style="{StaticResource SwitchButton}" />
<ToggleButton Grid.Row="1"
Grid.Column="0"
Content="禁用切换按钮"
IsEnabled="False" />
<ToggleButton Grid.Row="1"
Grid.Column="1"
IsEnabled="False"
Style="{StaticResource SwitchButton}" />
</UniformGrid>
</GroupBox>
<GroupBox enu:AnchorAssist.AnchorName="文本标签" Header="文本标签">
<UniformGrid Rows="1">
<Label Content="默认标签" />
<Label Content="主要标签" Style="{StaticResource LabelPrimary}" />
<Label Content="禁用默认标签" IsEnabled="False" />
<Label Content="禁用主要标签"
IsEnabled="False"
Style="{StaticResource LabelPrimary}" />
</UniformGrid>
</GroupBox>
<GroupBox enu:AnchorAssist.AnchorName="折叠" Header="折叠">
<Expander Header="折叠" IsExpanded="True" />
</GroupBox>
<GroupBox enu:AnchorAssist.AnchorName="单选复选框" Header="单选复选框">
<UniformGrid Rows="1">
<CheckBox Content="进度不确定" />
<CheckBox Content="禁用进度不确定"
IsChecked="{x:Null}"
IsEnabled="False" />
<RadioButton Content="单选按钮 A"
GroupName="RadioG"
IsChecked="{x:Null}" />
<RadioButton Content="单选按钮 B" GroupName="RadioG" />
</UniformGrid>
</GroupBox>
</StackPanel>
<GroupBox enu:AnchorAssist.AnchorName="滑动/滚动条" Header="滑动/滚动条">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" Height="100">
<Slider x:Name="ProgressVerticalSlider"
Value="25"
Maximum="100"
Minimum="0"
Orientation="Vertical" />
<ProgressBar Grid.Column="1"
Height="100"
Value="{Binding ElementName=ProgressVerticalSlider, Path=Value}"
IsIndeterminate="{Binding ElementName=ProgressCheckbox, Path=IsChecked}"
Maximum="100"
Minimum="0"
Orientation="Vertical" />
</StackPanel>
<StackPanel Grid.Column="1">
<Slider x:Name="ProgressSlider"
Value="25"
Maximum="100"
Minimum="0" />
<ProgressBar Value="{Binding ElementName=ProgressSlider, Path=Value}"
IsIndeterminate="{Binding ElementName=ProgressCheckbox, Path=IsChecked}"
Maximum="100"
Minimum="0" />
</StackPanel>
</Grid>
</GroupBox>
<GroupBox Grid.Column="1"
Margin="4"
enu:AnchorAssist.AnchorName="日期"
Header="日期">
<StackPanel Margin="4,0" Orientation="Horizontal">
<DatePicker Width="200" />
<Calendar>
<Calendar.BlackoutDates>
<CalendarDateRange End="2022/7/12" Start="2022/7/10" />
</Calendar.BlackoutDates>
</Calendar>
</StackPanel>
</GroupBox>
<GroupBox enu:AnchorAssist.AnchorName="选择" Header="选择">
<UniformGrid Rows="1">
<TreeView Grid.Row="0" Margin="4">
<TreeViewItem Header="A123" IsExpanded="True">
<TreeViewItem Header="B123"
IsExpanded="True"
IsSelected="True">
<TreeViewItem Header="C123" />
</TreeViewItem>
<TreeViewItem Header="B456" IsEnabled="False" />
</TreeViewItem>
</TreeView>
<ListBox Margin="4">
<ListBoxItem>SyminOmega</ListBoxItem>
<ListBoxItem>Celeron533</ListBoxItem>
<ListBoxItem>Hello World</ListBoxItem>
<ListBoxItem>Furry Fantasy</ListBoxItem>
<ListBoxItem>Item Demo</ListBoxItem>
<ListBoxItem>Item Demo</ListBoxItem>
</ListBox>
<ListView Margin="4"
DataContext="{StaticResource Dgd}"
ItemsSource="{Binding DataCollection}">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding Id}" Header="ID" />
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="Name" />
<GridViewColumn DisplayMemberBinding="{Binding Age}" Header="Age" />
<GridViewColumn DisplayMemberBinding="{Binding Mark}" Header="Mark" />
<GridViewColumn DisplayMemberBinding="{Binding Gender}" Header="Gender" />
</GridView>
</ListView.View>
</ListView>
</UniformGrid>
</GroupBox>
<GroupBox enu:AnchorAssist.AnchorName="数据展示" Header="数据展示">
<TabControl Style="{StaticResource NavigationTabControl}">
<TabItem Header="选项卡 1">
<Grid Margin="4">
<Separator Grid.Row="1" />
<DataGrid Grid.Row="3"
Margin="4"
DataContext="{StaticResource Dgd}"
ItemsSource="{Binding DataCollection}" />
</Grid>
</TabItem>
<TabItem Header="选项卡 2" />
<TabItem Header="禁用选项卡" IsEnabled="False" />
</TabControl>
</GroupBox>
</StackPanel>
</enu:Anchor>
<!-- 状态栏部分 -->
<StatusBar Grid.Row="2">
<TextBlock Text="★" />
<TextBlock Text="状态栏" />
<Separator />
<TextBlock x:Name="TextMessage" Text="消息" />
</StatusBar>
</Grid>
</Window>

View File

@@ -0,0 +1,38 @@
using System.Windows;
using System.Windows.Controls;
using NeuWPF.Appearance;
namespace NeuWPFTest
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if(!_loaded ) return;
TextMessage.Text = "选项变化" + e.OriginalSource;
}
private bool _loaded = false;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
_loaded = true;
}
private void Switch_OnClick(object sender, RoutedEventArgs e)
{
ThemeManager.SwitchThemeMode();
}
private void Test_OnClick(object sender, RoutedEventArgs e)
{
new ControlTestWindow().Show();
}
}
}

View File

@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net462</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>12.0</LangVersion>
<UseWPF>true</UseWPF>
<!-- <Version>1.1.1</Version>-->
<ApplicationIcon>Resources\SyminUI.ico</ApplicationIcon>
<!-- <PackageVersion>1.1.1</PackageVersion>-->
<!-- <UseWindowsForms>true</UseWindowsForms>-->
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\Images\ImageTest.png" />
<None Remove="Resources\Images\SyminUI.png" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Images\ImageTest.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Resources\Images\SyminUI.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Resources\SyminUI.ico">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NeuWPF\NeuWPF.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB