CgdataBase.WPF.Common
1.9.12
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package CgdataBase.WPF.Common --version 1.9.12
NuGet\Install-Package CgdataBase.WPF.Common -Version 1.9.12
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="CgdataBase.WPF.Common" Version="1.9.12" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CgdataBase.WPF.Common" Version="1.9.12" />
<PackageReference Include="CgdataBase.WPF.Common" />
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 CgdataBase.WPF.Common --version 1.9.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CgdataBase.WPF.Common, 1.9.12"
#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 CgdataBase.WPF.Common@1.9.12
#: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=CgdataBase.WPF.Common&version=1.9.12
#tool nuget:?package=CgdataBase.WPF.Common&version=1.9.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CgdataBase.WPF.Common
概述
CgdataBase.WPF.Common 是基于 CgdataBase.WPF 的 WPF 通用基础库,主要提供一组可复用的 MVVM 绑定行为、应用基础设施与常用控制器/工具类,帮助统一 WPF 项目的通用能力实现(通知、单例、Dock、UI 状态持久化、Excel、校验、版本检查等)。
目标框架
net8.0-windowsnet10.0-windows
目录结构
Behaviors/:WPF 行为(Behavior)与附加属性(Attached Property),用于提升 XAML 可绑定性与交互一致性Events/:基于 Prism 的事件定义(PubSubEvent)Helpers/:应用基础设施、控制器与通用工具类ViewModelBase.cs:通用 ViewModel 基类
主要能力
1) MVVM 绑定行为与附加属性(Behaviors)
AvalonEditBehaviour:为 AvalonEdit 提供CodeText双向绑定能力(支持 MVVM 绑定编辑器文本)PasswordBoxBehaviour:为PasswordBox提供Password双向绑定能力(支持 MVVM 绑定密码)DataGridSelectedItemsBehavior/ListBoxSelectedItemsBehavior:为多选控件提供SelectedItems绑定能力BindingSelectItemsAttach:为DataGrid/ListBox的SelectedItems提供简单附加属性封装DialogCloser:通过附加属性设置Window.DialogResult,便于 MVVM 关闭对话框ScrollIntoViewBehavior:附加属性触发ScrollIntoView,用于列表/表格自动滚动定位TreeViewHelper:为TreeView提供SelectedItem可绑定能力
2) 应用基础设施(Helpers)
ApplicationBase- 全局异常捕获(UI 线程、Task、AppDomain)并统一记录日志/弹出提示
- 通知封装(基于
Notification.Wpf) - 单例启动支持(互斥锁 + 命名管道唤醒)
- 常用窗口与应用信息获取(活跃窗口、程序集名、应用数据目录等)
AppSettingsBase:基础配置类(XML 持久化),包含常用 UI/字体、数据库、更新服务等默认配置项IocManage:对 Prism 容器、事件聚合器与全局配置的统一访问入口
3) UI 状态持久化(Helpers)
DataGridController:保存/恢复DataGrid列宽、可见性等显示信息GridController:保存/恢复Grid的行高/列宽(基于 JSON 序列化)ColumnDisplayInfo:列显示信息模型(同时支持DataGridLength/GridLength)
4) Dock/文档管理(Helpers)
DockController:基于 AvalonDock 的文档页管理封装(打开/激活/关闭文档、更新标题、获取活动内容等)
5) 数据导入导出(Helpers)
ExcelController:基于 NPOI 的 Excel 读写辅助(打开/创建工作簿、导入为DataTable等)
6) 版本检查与更新探测(Helpers)
UpdateHelper:基于 NetMQ 的版本请求(同步/异步)VersionController:版本检查与提示封装(可主动提示最新版本信息)
7) 数据校验与通用工具(Helpers)
ValidationController:轻量校验器,支持链式条件校验、错误聚合、失败回调策略TextCodeGuessHelper:文本编码识别与读取工具(支持 UTF-8/Unicode/GBK 等;可注册更多编码)FontController:系统字体枚举与中文字体筛选PipeController:命名管道服务端/客户端封装(用于单例唤醒、消息通知)ElementHelper:少量历史兼容方法与通用能力(部分成员已标记过时)
8) Prism 事件定义(Events)
ShowMainWindowEvent/HideMainWindowEvent:主窗口显示/隐藏事件ApplicationExitEvent:应用退出事件ShowWindowEvent/HideWindowEvent:旧事件(已标记过时,保留用于兼容)
第三方依赖
本库通过 NuGet 引用以下组件(以项目文件为准):
AvalonEdit:代码编辑器控件Extended.Wpf.Toolkit:扩展控件库(包含 AvalonDock)gong-wpf-dragdrop:拖拽支持MahApps.Metro.IconPacks:图标资源包Mapster:对象映射Microsoft.Xaml.Behaviors.Wpf:Behavior 基础设施NetMQ:消息通信(用于版本探测)Newtonsoft.Json:JSON 序列化/反序列化NLog:日志Notification.Wpf:通知/ToastNPOI:Excel 读写Prism.Unity:MVVM/依赖注入/事件聚合ReactiveUI:响应式编程支持
备注
- 本库依赖并复用
CgdataBase.WPF中的基础能力(例如UISettings、JsonEngine、BindableBase等)。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0-windows7.0
- AvalonEdit (>= 6.3.1.120)
- CgdataBase.WPF (>= 1.9.12)
- Extended.Wpf.Toolkit (>= 5.0.0)
- gong-wpf-dragdrop (>= 4.0.0)
- MahApps.Metro.IconPacks.Material (>= 6.2.1)
- Mapster (>= 10.0.3)
- Microsoft.Xaml.Behaviors.Wpf (>= 1.1.142)
- NetMQ (>= 4.0.2.2)
- Newtonsoft.Json (>= 13.0.4)
- NLog (>= 6.1.1)
- Notification.Wpf (>= 8.0.0)
- NPOI (>= 2.7.6)
- Prism.DryIoc (>= 9.0.537)
- ReactiveUI (>= 23.1.8)
-
net8.0-windows7.0
- AvalonEdit (>= 6.3.1.120)
- CgdataBase.WPF (>= 1.9.12)
- Extended.Wpf.Toolkit (>= 5.0.0)
- gong-wpf-dragdrop (>= 4.0.0)
- MahApps.Metro.IconPacks.Material (>= 6.2.1)
- Mapster (>= 10.0.3)
- Microsoft.Xaml.Behaviors.Wpf (>= 1.1.142)
- NetMQ (>= 4.0.2.2)
- Newtonsoft.Json (>= 13.0.4)
- NLog (>= 6.1.1)
- Notification.Wpf (>= 8.0.0)
- NPOI (>= 2.7.6)
- Prism.DryIoc (>= 9.0.537)
- ReactiveUI (>= 23.1.8)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on CgdataBase.WPF.Common:
| Package | Downloads |
|---|---|
|
CgdataBase.WPF.Plus
Package Description |
|
|
CgdataBase.WPF.Metro
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.9.21 | 86 | 4/15/2026 |
| 1.9.19 | 87 | 4/8/2026 |
| 1.9.16 | 86 | 4/7/2026 |
| 1.9.12 | 91 | 4/3/2026 |
| 1.9.11 | 100 | 3/25/2026 |
| 1.9.8 | 91 | 3/23/2026 |
| 1.9.7 | 87 | 3/23/2026 |
| 1.9.6 | 91 | 3/20/2026 |
| 1.9.5 | 91 | 3/19/2026 |
| 1.9.4 | 88 | 3/18/2026 |
| 1.9.3 | 133 | 1/6/2026 |
| 1.9.2.3 | 208 | 12/25/2025 |
| 1.9.2.2 | 144 | 12/13/2025 |
| 1.9.2 | 189 | 12/5/2025 |
| 1.9.1.3 | 201 | 11/25/2025 |
| 1.9.1 | 274 | 11/22/2025 |
| 1.9.0 | 341 | 11/21/2025 |
| 1.8.3 | 444 | 11/20/2025 |
| 1.8.2.6 | 412 | 11/19/2025 |
| 1.8.2.1 | 424 | 11/18/2025 |
Loading failed