【问题标题】:WPF Extended Toolkit PropertyGrid - Compose SelectedObjectWPF 扩展工具包 PropertyGrid - 编写 SelectedObject
【发布时间】:2017-09-26 15:32:46
【问题描述】:
我有一个绑定到 WPF 扩展工具包 PropertyGrid 的 SelectedObject 属性的设置类。 Settings 类由另外两个类组成:DisplaySettings 和 IOSettings。我希望这两个类在 PropertyGrid 中显示为单独的类别,并希望它们的属性显示为这些类别下的子项。但是,在显示 PropertyGrid 时,这些子类的属性并没有显示出来。仅显示类名,并以完整的类名作为其值。
如何让这些子类的属性显示在 PropertyGrid 中?
【问题讨论】:
标签:
c#
wpf
propertygrid
wpf-extended-toolkit
【解决方案1】:
您应该将ExpandableObject 属性添加到属性。此属性位于 Xceed.Wpf.Toolkit.PropertyGrid.Attributes 命名空间中。
...
[ExpandableObject]
public CDisplaySettings CDisplaySettings { get; set; }
[ExpandableObject]
public CIOSettings CIOSettings { get; set; }
...