简体   繁体   中英

WPF Extended Toolkit PropertyGrid - Compose SelectedObject

I have a Settings class that is bound to a WPF Extended Toolkit PropertyGrid's SelectedObject property. The Settings class is composed of two other classes: DisplaySettings and 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. However, when the PropertyGrid is displayed, the properties of these sub-classes are not displayed. 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. This attribute lives in Xceed.Wpf.Toolkit.PropertyGrid.Attributes namespace.

...
[ExpandableObject]
public CDisplaySettings CDisplaySettings { get; set; }
[ExpandableObject]
public CIOSettings CIOSettings { get; set; }
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM