是否有任何方法可以自定义 Winforms PropertyGrid,如果它需要在顶部(整行)显示一个没有类别的元素,而在下面显示几个包含元素的类别?
最佳答案
using System;
using System.ComponentModel;
using System.Windows.Forms;
static class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
using (var form = new Form {
Controls = {
new PropertyGrid { Dock = DockStyle.Fill,
SelectedObject = new Test {
Foo = "one element without category",
Bar = "several categories",
Blip = "with elements",
Blap = "inside",
Blop = "below"
}}}}) {
Application.Run(form);
}
}
}
class Test {
[Category(" ")] public string Foo { get; set; }
[Category("x")] public string Bar{ get; set; }
[Category("x")] public string Blip { get; set; }
[Category("y")] public string Blap { get; set; }
[Category("y")] public string Blop { get; set; }
}
关于c# - 具有空和非空类别的 WinForms PropertyGrid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4322150/