Zhy.Components.Wpf
1.2.0.2
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Core 3.0
This package targets .NET Core 3.0. The package is compatible with this framework or higher.
.NET Framework 4.5
This package targets .NET Framework 4.5. The package is compatible with this framework or higher.
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Zhy.Components.Wpf --version 1.2.0.2
NuGet\Install-Package Zhy.Components.Wpf -Version 1.2.0.2
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="Zhy.Components.Wpf" Version="1.2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zhy.Components.Wpf" Version="1.2.0.2" />
<PackageReference Include="Zhy.Components.Wpf" />
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 Zhy.Components.Wpf --version 1.2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Zhy.Components.Wpf, 1.2.0.2"
#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 Zhy.Components.Wpf@1.2.0.2
#: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=Zhy.Components.Wpf&version=1.2.0.2
#tool nuget:?package=Zhy.Components.Wpf&version=1.2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Zhy.Components.Wpf
Doc
UserControl
ZDataGrid
Demo
ZDataGrid-IsReadOnly

ZDataGrid

ZDataGrid-ZFormTextButtonColumn

ZDataGrid-ZFormComboColumn

ZDataGrid-ZFormMultiCheckColumn

ZDataGrid-Search

Windows
ZFormDialog

ZFormGrid

ZFormGroupGrid

Demo
添加资源字典
<ResourceDictionary Source="pack://application:,,,/Zhy.Components.Wpf;component\Views\Theme\AppDictionary.xaml" />
AccountInfo.cs
/// <summary>
/// 账户信息
/// </summary>
public class AccountInfo : ObservableObject
{
private int _no;
private bool _isChecked;
private string? _username;
private string? _createDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
private string? _role;
private bool _enable;
private string? _phone;
private string? _archivesPath;
private List<Permission> _permission = new List<Permission>()
{
new Permission(false, "测试项1","测试项1"),
new Permission(false, "测试项2","测试项2"),
new Permission(false, "测试项3","测试项3"),
new Permission(false, "测试项4","测试项4"),
new Permission(false, "测试项5","测试项5")
};
private List<string> _roles = new List<string>()
{
"系统管理员", "角色1"
};
/// <summary>
/// 序号
/// </summary>
[ZFormTextColumn("序 号", Index = 1, IsReadOnlyColumn = true, IsHideFormItem = true, Width = 30, WidthUnit = DataGridLengthUnitType.Pixel)]
public int NO { get => _no; set => SetProperty(ref _no, value); }
/// <summary>
/// 选择
/// </summary>
[ZFormCheckColumn("选 择", Index = 0, IsHideFormItem = true, Width = 30, WidthUnit = DataGridLengthUnitType.Pixel)]
public bool IsChecked { get => _isChecked; set => SetProperty(ref _isChecked, value); }
/// <summary>
/// 用户名
/// </summary>
[ZFormTextColumn("用户名", Index = 1, IsHideFormColumn = false, IsReadOnlyColumn = false, IsHideFormItem = false, IsReadOnlyItem = false, IsSearchProperty = true, MemberPath = null, Width = 100, WidthUnit = DataGridLengthUnitType.Pixel)]
public virtual string? Username { get => _username; set => SetProperty(ref _username, value); }
/// <summary>
/// 创建日期
/// </summary>
[ZFormDateColumn("创建日期", Index = 2, Width = 200, WidthUnit = DataGridLengthUnitType.Pixel)]
public string? CreateDate { get => _createDate; set => SetProperty(ref _createDate, value); }
/// <summary>
/// 用户角色
/// </summary>
[ZFormComboColumn("角 色", Index = 3, IsSearchProperty = true, ItemsSourceProperty = nameof(Roles), Width = 100, WidthUnit = DataGridLengthUnitType.Pixel)]
public string? Role { get => _role; set => SetProperty(ref _role, value); }
/// <summary>
/// 全部角色
/// </summary>
public List<string> Roles { get => _roles; set => _roles = value; }
/// <summary>
/// 可用状态
/// </summary>
[ZFormCheckColumn("状 态", Index = 3, Width = 30, WidthUnit = DataGridLengthUnitType.Pixel)]
public bool Enable { get => _enable; set => SetProperty(ref _enable, value); }
/// <summary>
/// 联系电话
/// </summary>
[ZFormTextColumn("联系电话", Index = 4, IsSearchProperty = true, Width = 100, WidthUnit = DataGridLengthUnitType.Pixel)]
public string? Phone { get => _phone; set => SetProperty(ref _phone, value); }
/// <summary>
/// 档案路径
/// </summary>
[ZFormTextButtonColumn("档案路径", Index = 5, ButtonContent = "更 改", RelayCommandName = nameof(CommandModifyArchivesPath), Width = 200, WidthUnit = DataGridLengthUnitType.Pixel)]
public string? ArchivesPath { get => _archivesPath; set => SetProperty(ref _archivesPath, value); }
/// <summary>
/// 更改档案路径命令
/// </summary>
public RelayCommand<AccountInfo> CommandModifyArchivesPath => new RelayCommand<AccountInfo>(ModifyArchivesPath);
private void ModifyArchivesPath(AccountInfo? accountInfo)
{
if (accountInfo == null)
{
return;
}
OpenFileDialog fileDialog = new OpenFileDialog();
bool? dr = fileDialog.ShowDialog();
if (dr == false)
{
return;
}
accountInfo.ArchivesPath = fileDialog.FileName;
}
/// <summary>
/// 权限信息
/// </summary>
[ZFormMultiCheckColumn("权 限", "IsChecked", "Name", IsSearchProperty = true, WidthUnit = DataGridLengthUnitType.Auto)]
public List<Permission> Permission { get => _permission; set => SetProperty(ref _permission, value); }
/// <summary>
/// 查看信息命令
/// </summary>
[ZFormOperColumnButton("查看", Index = 0, ButtonStyle = ZFormButtonStyle.InfoButton)]
public RelayCommand<Tuple<object?, IList?>> CommandViewItem => new RelayCommand<Tuple<object?, IList?>>(ViewItem);
private void ViewItem(Tuple<object?, IList?>? param)
{
if (param == null)
{
return;
}
AccountInfo? accountInfo = param.Item1 as AccountInfo;
if (accountInfo == null)
{
return;
}
string msg = FormItemUtils.Print(accountInfo);
MessageBox.Show(msg, "属性信息", MessageBoxButton.OK, MessageBoxImage.Information);
}
/// <summary>
/// 更新命令
/// </summary>
[ZFormOperColumnButton("更新", Index = 0, ButtonStyle = ZFormButtonStyle.WarnButton)]
public RelayCommand<Tuple<object?, IList?>> CommandUpdateItem => new RelayCommand<Tuple<object?, IList?>>(UpdateItem);
private void UpdateItem(Tuple<object?, IList?>? param)
{
MessageBox.Show("更新");
}
/// <summary>
/// 导出命令
/// </summary>
[ZFormOperColumnButton("导出", Index = 0, ButtonStyle = ZFormButtonStyle.SuccessButton)]
public RelayCommand<Tuple<object?, IList?>> CommandExportItem => new RelayCommand<Tuple<object?, IList?>>(ExportItem);
private void ExportItem(Tuple<object?, IList?>? param)
{
MessageBox.Show("导出");
}
/// <summary>
/// 删除命令
/// </summary>
[ZFormOperColumnButton("删 除", Index = 1, ButtonStyle = ZFormButtonStyle.ErrorButton)]
public RelayCommand<Tuple<object?, IList?>> CommandDeleteItem => new RelayCommand<Tuple<object?, IList?>>(DeleteItem);
private void DeleteItem(Tuple<object?, IList?>? param)
{
if (param == null)
{
return;
}
AccountInfo? accountInfo = param.Item1 as AccountInfo;
IList? accountInfos = param.Item2 as IList;
MessageBoxResult messageBoxResult = MessageBox.Show("确认删除?!", "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (messageBoxResult != MessageBoxResult.Yes)
{
return;
}
accountInfos?.Remove(accountInfo);
}
/// <summary>
/// 全选命令
/// </summary>
[ZFormToolButton("全 选", Index = 0, Dock = Dock.Right, ButtonStyle = ZFormButtonStyle.DefaultButton, Location = ButtonLocation.Bottom)]
public RelayCommand<IList?> CommandCheckTotalItem => new RelayCommand<IList?>(CheckTotalItem);
private void CheckTotalItem(IList? items)
{
if (items == null) return;
foreach (AccountInfo? item in items)
{
if (item == null) continue;
item.IsChecked = true;
}
}
/// <summary>
/// 全不选命令
/// </summary>
[ZFormToolButton("全不选", Index = 1, Location = ButtonLocation.Bottom)]
public RelayCommand<IList?> CommandUncheckTotalItem => new RelayCommand<IList?>(UncheckTotalItem);
private void UncheckTotalItem(IList? items)
{
if (items == null) return;
foreach (AccountInfo? item in items)
{
if (item == null) continue;
item.IsChecked = false;
}
}
/// <summary>
/// 添加用户命令
/// </summary>
[ZFormToolButton("添 加", Index = 0, ButtonStyle = ZFormButtonStyle.InfoButton)]
public RelayCommand<IList?> CommandAddItem => new RelayCommand<IList?>(AddItem);
private async void AddItem(IList? items)
{
if (items == null) return;
AccountInfo accountInfo = new AccountInfo();
await Task.Run(() =>
{
Application.Current.Dispatcher.Invoke(() =>
{
ZFormDialog zFormDialog = new ZFormDialog(accountInfo);
zFormDialog.Title = "Add";
bool? dr = zFormDialog.ShowDialog();
if (dr == false)
{
return;
}
});
});
items.Add(accountInfo);
accountInfo.NO = items.IndexOf(accountInfo) + 1;
}
/// <summary>
/// 批量删除命令
/// </summary>
[ZFormToolButton("批量删除", Index = 1, ButtonStyle = ZFormButtonStyle.ErrorButton)]
public RelayCommand<IList?> CommandBatchDeleteItem => new RelayCommand<IList?>(BatchDeleteItem);
private void BatchDeleteItem(IList? items)
{
if (items == null) return;
List<AccountInfo> rm = new List<AccountInfo>();
foreach (AccountInfo accountInfo in items)
if (accountInfo?.IsChecked == true)
rm.Add(accountInfo);
if (rm.Count < 1)
return;
MessageBoxResult messageBoxResult = MessageBox.Show("确认删除?!", "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (messageBoxResult != MessageBoxResult.Yes)
return;
foreach (var item in rm)
items.Remove(item);
}
}
Permission.cs
/// <summary>
/// 权限类
/// </summary>
public class Permission : ObservableObject
{
private bool _isChecked = false;
/// <summary>
/// 选择
/// </summary>
public bool IsChecked
{
get { return _isChecked; }
set { SetProperty(ref _isChecked, value); }
}
/// <summary>
/// 权限名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 说明
/// </summary>
public string Desc { get; set; }
/// <summary>
/// 权限
/// </summary>
/// <param name="isChecked">选择</param>
/// <param name="name">权限名</param>
/// <param name="desc">说明</param>
public Permission(bool isChecked, string name, string desc)
{
IsChecked = isChecked;
Name = name;
Desc = desc;
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net5.0-windows7.0 is compatible. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net6.0-windows7.0 is compatible. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net7.0-windows7.0 is compatible. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 is compatible. netcoreapp3.1 is compatible. |
| .NET Framework | net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.0
- No dependencies.
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETFramework 4.8.1
- No dependencies.
-
net5.0-windows7.0
- No dependencies.
-
net6.0-windows7.0
- No dependencies.
-
net7.0-windows7.0
- No dependencies.
-
net8.0-windows7.0
- 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.添加支持版本;2.取消图标注入;3.修改主题颜色;