WPF Extended Toolkit PropertyGrid - Compose SelectedObject

342 Views Asked by At

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?

Sub-class PropertyGrid Screenshot

1

There are 1 best solutions below

0
On BEST ANSWER

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; }
...