![]() |
VOOZH | about |
dotnet add package CgdataBase.WPF.Metro --version 1.9.34
NuGet\Install-Package CgdataBase.WPF.Metro -Version 1.9.34
<PackageReference Include="CgdataBase.WPF.Metro" Version="1.9.34" />
<PackageVersion Include="CgdataBase.WPF.Metro" Version="1.9.34" />Directory.Packages.props
<PackageReference Include="CgdataBase.WPF.Metro" />Project file
paket add CgdataBase.WPF.Metro --version 1.9.34
#r "nuget: CgdataBase.WPF.Metro, 1.9.34"
#:package CgdataBase.WPF.Metro@1.9.34
#addin nuget:?package=CgdataBase.WPF.Metro&version=1.9.34Install as a Cake Addin
#tool nuget:?package=CgdataBase.WPF.Metro&version=1.9.34Install as a Cake Tool
CgdataBase.WPF.Metro 是基于 MahApps.Metro 的 WPF UI 扩展库,建立在 CgdataBase.WPF.Common 之上,提供一套可直接复用的 Metro 风格基础样式资源,以及常用对话框/窗口(消息框、输入框、字体选择、设置/关于等)。
Install-Package CgdataBase.WPF.Metro
dotnet add package CgdataBase.WPF.Metro
位于 Styles/,主要用于统一控件间距、对话框窗口行为与常用控件样式。
BaseStyle.xaml:聚合基础控件样式(Button / TextBox / DataGrid / Window 等)Base/Window.xaml:提供 DialogWindowStyle / DialogWindowStyle2,用于统一 MetroWindow 对话框行为(如隐藏任务栏图标、禁用调整大小等)Margin1.xaml ~ Margin6.xaml:提供 ControlMargin 资源(1~6),用于统一控件间距Fonts.xaml:覆盖 MahApps 默认字体/字号/大小写规则(可按需引入)位于 Views/,均基于 MahApps.Metro.Controls.MetroWindow。
MessageBox:与 WPF MessageBox 类似的消息框,提供 Show(...) 静态方法(支持 OK/OKCancel/YesNo/YesNoCancel),并确保在 UI 线程显示InputBox:带提示文本的输入框(必填校验,空值会提示并聚焦输入框)InputBox2:简化输入框(适合更大文本输入,默认尺寸可通过 IocManage 配置)WinSelectFont:字体选择窗口(支持只显示中文字体、关键字过滤、双击确认)WinSettingsBase + UcSettingsBase:通用“设置”窗口与内容控件,包含字体/数据库/文本字体等常用设置项(配合 WinSettingsBaseViewModel 使用)WinAbout:通用“关于”窗口,显示应用名/版本/ReleaseNote,并可选启用“检查更新/版本信息”位于 ViewModels/。
WinAboutViewModel:加载应用信息与 ReleaseNote.txt,可选触发版本检查逻辑WinSettingsBaseViewModel:设置窗口的默认实现,提供校验、字体选择、数据库连接串生成等逻辑;支持 SettingsMode 控制页面显示项需要先引入 MahApps 的基础资源,再引入本库的 Margin/BaseStyle(示例可参考 CgdataBaseDemo/App.xaml)。
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Dark.Emerald.xaml" />
<ResourceDictionary Source="pack://application:,,,/CgdataBase.WPF.Metro;Component/Styles/Margin2.xaml" />
<ResourceDictionary Source="pack://application:,,,/CgdataBase.WPF.Metro;Component/Styles/BaseStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
using System.Windows;
using CgdataBase.Views;
var result = CgdataBase.Views.MessageBox.Show(this, "确定要删除吗?", "提示", MessageBoxButton.YesNo);
var name = InputBox.Show(this, "请输入名称:", value: "", title: "输入");
if (!string.IsNullOrWhiteSpace(name))
{
// use name
}
using CgdataBase;
using CgdataBase.ViewModels;
using CgdataBase.Views;
IAppSettingsBase settings = ...;
var win = new WinSettingsBase { Owner = this };
win.DataContext = new WinSettingsBaseViewModel(settings, SettingsMode.字体_数据库);
var ok = win.ShowDialog() == true;
using CgdataBase;
using CgdataBase.ViewModels;
using CgdataBase.Views;
IAppSettingsBase settings = ...;
var win = new WinAbout { Owner = this };
var vm = new WinAboutViewModel();
vm.LoadInfo(settings, appName: "MyApp", checkVersion: true);
win.DataContext = vm;
win.ShowDialog();
当应用输出目录存在 ReleaseNote.txt 时,WinAboutViewModel 会读取并显示其内容。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 net8.0-windows7.0 is compatible. net9.0-windows net9.0-windows was computed. net10.0-windows net10.0-windows was computed. net10.0-windows7.0 net10.0-windows7.0 is compatible. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.9.34 | 91 | 6/15/2026 |
| 1.9.33 | 93 | 6/9/2026 |
| 1.9.32 | 92 | 6/3/2026 |
| 1.9.30 | 100 | 5/11/2026 |
| 1.9.29 | 99 | 5/2/2026 |
| 1.9.28 | 107 | 4/28/2026 |
| 1.9.26 | 103 | 4/27/2026 |
| 1.9.21 | 114 | 4/15/2026 |
| 1.9.19 | 111 | 4/8/2026 |
| 1.9.16 | 109 | 4/7/2026 |
| 1.9.12 | 115 | 4/3/2026 |
| 1.9.11 | 124 | 3/25/2026 |
| 1.9.8.2 | 109 | 3/23/2026 |
| 1.9.7 | 109 | 3/23/2026 |
| 1.9.6 | 108 | 3/20/2026 |
| 1.9.5 | 108 | 3/19/2026 |
| 1.9.4 | 109 | 3/18/2026 |
| 1.9.3.4 | 125 | 2/10/2026 |
| 1.9.3.2 | 112 | 2/10/2026 |
| 1.9.3 | 124 | 1/6/2026 |