[英]WPF Extended Toolkit PropertyGrid - Compose SelectedObject
I have a Settings class that is bound to a WPF Extended Toolkit PropertyGrid's SelectedObject property. 我有一个绑定到WPF扩展工具包PropertyGrid的SelectedObject属性的Settings类。 The Settings class is composed of two other classes: DisplaySettings and IOSettings.
Settings类由另外两个类组成:DisplaySettings和IOSettings。 I would like these two classes to appear as separate categories in the PropertyGrid and would like their properties to be displayed as subitems under these categories.
我希望这两个类在PropertyGrid中显示为单独的类别,并希望它们的属性在这些类别下显示为子项。 However, when the PropertyGrid is displayed, the properties of these sub-classes are not displayed.
但是,当显示PropertyGrid时,不会显示这些子类的属性。 Only the class names are displayed with the full class name as their values.
仅显示类名,并以完整的类名作为其值。
How do I get the properties of these sub-classes to be displayed in the PropertyGrid? 如何获取这些子类的属性以显示在PropertyGrid中?
You should add ExpandableObject
attribute to properties. 您应该将
ExpandableObject
属性添加到属性。 This attribute lives in Xceed.Wpf.Toolkit.PropertyGrid.Attributes
namespace. 此属性位于
Xceed.Wpf.Toolkit.PropertyGrid.Attributes
命名空间中。
...
[ExpandableObject]
public CDisplaySettings CDisplaySettings { get; set; }
[ExpandableObject]
public CIOSettings CIOSettings { get; set; }
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.