GwhUI 1.0.1.1

dotnet add package GwhUI --version 1.0.1.1
                    
NuGet\Install-Package GwhUI -Version 1.0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GwhUI" Version="1.0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GwhUI" Version="1.0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="GwhUI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GwhUI --version 1.0.1.1
                    
#r "nuget: GwhUI, 1.0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GwhUI@1.0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GwhUI&version=1.0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=GwhUI&version=1.0.1.1
                    
Install as a Cake Tool

GwhUI_Net_40 调用文档

项目概述

GwhUI_Net_40 是一个基于 WPF 的 UI 控件库,提供了一系列现代化、扁平化的控件样式和模板。该项目包含多种常用控件的自定义样式,可以帮助开发者快速构建美观的桌面应用程序。

目录结构

GwhUI_Net_40/
├── Behaviors/           # 行为类
│   └── TextBoxHelper.cs
├── Commons/             # 公共类
│   ├── NotifyObject.cs
│   └── RelayCommand.cs
├── Converters/          # 转换器
│   └── BoolToVisibilityConverter.cs
├── Themes/Styles/       # 样式资源
│   ├── ButtonStyles.xaml
│   ├── IconPaths.xaml
│   ├── ProgressBarStyles.xaml
│   ├── TabControlStyles.xaml
│   ├── TextBlockStyles.xaml
│   ├── TextBoxStyles.xaml
│   └── TreeViewStyles.xaml

控件样式和使用方法

1. 按钮 (Button)

可用样式
  • FlatButtonPrimary - 主要按钮
  • FlatButtonSuccess - 成功按钮
  • FlatButtonInfo - 信息按钮
  • FlatButtonWarning - 警告按钮
  • FlatButtonDanger - 危险按钮
  • FlatButtonSecondary - 次要按钮
  • FlatButtonIcon - 图标按钮
  • FlatButtonSmall - 小型按钮
  • FlatButtonLarge - 大型按钮
使用示例
<Button Content="主要按钮" Style="{StaticResource FlatButtonPrimary}" />
<Button Content="成功按钮" Style="{StaticResource FlatButtonSuccess}" />

2. 文本框 (TextBox)

可用样式
  • FlatWatermarkTextBox - 带水印文本框
  • FlatTextBoxOutline - 边框样式文本框
  • FlatTextBoxRounded - 圆角文本框
  • FlatTextBoxSmall - 小尺寸文本框
  • FlatTextBoxLarge - 大尺寸文本框
  • FlatTextBoxSuccess - 成功状态文本框
  • FlatTextBoxWarning - 警告状态文本框
  • FlatTextBoxError - 错误状态文本框
  • FlatTextBoxPrimary - 主要状态文本框
  • FlatTextBoxDisabled - 禁用状态文本框
  • FlatTextBoxReadOnly - 只读状态文本框
  • FlatSearchBox - 搜索框
  • FlatPasswordBox - 密码框
  • FlatTextBoxMultiLine - 多行文本框
  • FlatTextArea - 文本区域
  • FlatTextBoxNoBorder - 无边框文本框
  • FlatTextBoxTransparent - 透明文本框
  • FlatTextBoxDark - 暗色主题文本框
  • FlatNumericBox - 数字文本框
使用示例
<TextBox Text="标准输入框" Style="{StaticResource FlatWatermarkTextBox}" />
<TextBox Text="边框样式" Style="{StaticResource FlatTextBoxOutline}" />

3. 文本块 (TextBlock)

可用样式
  • FlatTitleLarge - 大型标题
  • FlatTitleMedium - 中型标题
  • FlatTitleSmall - 小型标题
  • FlatBody - 普通正文
  • FlatBodyStrong - 加粗正文
  • FlatLabel - 标签文本
  • FlatTextSuccess - 成功状态文本
  • FlatTextDanger - 危险状态文本
  • FlatLink - 链接文本
  • FlatBadge - 徽章文本
  • FlatBadgeSuccess - 成功徽章
  • FlatCaption - 辅助文本
  • FlatTextMonospace - 等宽字体文本
使用示例
<TextBlock Text="大型标题" Style="{StaticResource FlatTitleLarge}" />
<TextBlock Text="普通正文" Style="{StaticResource FlatBody}" />

4. 进度条 (ProgressBar)

可用样式
  • FlatProgressBar - 基本进度条
  • FlatProgressBarSuccess - 成功状态进度条
  • FlatProgressBarWarning - 警告状态进度条
  • FlatProgressBarError - 错误状态进度条
  • FlatProgressBarInfo - 信息状态进度条
  • FlatProgressBarDark - 暗色进度条
  • FlatProgressBarThin - 细进度条
  • FlatProgressBarThick - 粗进度条
  • FlatProgressBarRounded - 圆角进度条
  • FlatProgressBarSquare - 方角进度条
  • FlatProgressBarMinimal - 极简进度条
  • FlatProgressBarStriped - 条纹进度条
  • FlatProgressBarIndeterminate - 不确定进度条
  • FlatProgressBarVertical - 垂直进度条
  • FlatProgressBarVerticalSuccess - 垂直成功进度条
  • FlatProgressBarVerticalWarning - 垂直警告进度条
使用示例
<ProgressBar Value="30" Style="{StaticResource FlatProgressBar}" />
<ProgressBar Value="60" Style="{StaticResource FlatProgressBarSuccess}" />

5. TabControl

可用样式
  • FlatTabControlStyle - 扁平化TabControl样式
  • BorderlessTabControlStyle - 无边框TabControl样式
  • ModernFlatTabControlStyle - 现代化扁平TabControl样式
TabItem样式
  • CardTabItemStyle - 卡片式TabItem
  • FlatTabItemStyle - 扁平化TabItem
  • IconTabItemStyle - 图标TabItem
  • ModernFlatTabItemStyle - 现代化扁平TabItem
  • ModernRoundedTabItemStyle - 现代化圆角TabItem
  • ModernFilledTabItemStyle - 现代化填充TabItem
使用示例
<TabControl Style="{StaticResource FlatTabControlStyle}">
    <TabItem Header="卡片1" Style="{StaticResource CardTabItemStyle}" />
</TabControl>

6. TreeView

可用样式
  • BaseTreeViewStyle - 基础TreeView样式
  • BaseTreeViewItemStyle - 基础TreeViewItem样式
  • TreeViewItemWithIconsStyle - 带图标TreeViewItem样式
  • CheckBoxTreeViewItemStyle - 带复选框TreeViewItem样式
使用示例
<TreeView ItemContainerStyle="{StaticResource TreeViewItemWithIconsStyle}" 
          Style="{StaticResource BaseTreeViewStyle}">
    <TreeViewItem Header="文件夹" Tag="Folder">
        <TreeViewItem Header="文档.docx" Tag="File" />
    </TreeViewItem>
</TreeView>

图标资源

在 IconPaths.xaml 中定义了丰富的图标资源,可通过静态资源引用:

<Path Data="{StaticResource IconHome}" />
<Path Data="{StaticResource IconSettings}" />

可用图标包括:Add、Delete、Edit、Search、Save、Refresh、Close、Menu、ArrowRight、ArrowLeft、Check、Download、Upload、Settings、Info、Warning、Error、Home、User、Lock、Mail、Phone、Star、Heart、Camera、Calendar、Cloud、Print、Share、Window、Stopwatch、Folder、Code、Document、Image、Video、Music、Chart、Database等。

在项目中引用GwhUI_Net_40

要在您的项目中使用GwhUI_Net_40,请按以下步骤操作:

  1. 添加对GwhUI_Net_40项目的引用
  2. 在App.xaml中合并资源字典:
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/GwhUI_Net_40;component/Themes/Styles/ButtonStyles.xaml" />
            <ResourceDictionary Source="pack://application:,,,/GwhUI_Net_40;component/Themes/Styles/TextBlockStyles.xaml" />
            <ResourceDictionary Source="pack://application:,,,/GwhUI_Net_40;component/Themes/Styles/TextBoxStyles.xaml" />
            <ResourceDictionary Source="pack://application:,,,/GwhUI_Net_40;component/Themes/Styles/ProgressBarStyles.xaml" />
            <ResourceDictionary Source="pack://application:,,,/GwhUI_Net_40;component/Themes/Styles/TabControlStyles.xaml" />
            <ResourceDictionary Source="pack://application:,,,/GwhUI_Net_40;component/Themes/Styles/TreeViewStyles.xaml" />
            <ResourceDictionary Source="pack://application:,,,/GwhUI_Net_40;component/Themes/Styles/IconPaths.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>
  1. 在XAML中直接使用样式:
<Button Content="测试按钮" Style="{StaticResource FlatButtonPrimary}" />

行为扩展

TextBoxHelper 提供了附加属性来增强TextBox功能:

  • TextBoxHelper.Watermark - 设置水印文本

使用示例:

<TextBox commons:TextBoxHelper.Watermark="请输入用户名" 
         Style="{StaticResource FlatWatermarkTextBox}" />
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1.1 211 12/22/2025
1.0.1 202 12/22/2025