Certain complex properties are capable of being expandable in the property grid. Categories will auto-expand by default, while expandable properties will not auto-expand by default. This behavior can be changed in several ways.
Determining Property Expandability
The Property
Value | Description |
---|---|
Default |
Indicates that properties will be expandable if the associated type converter allows sub-properties to be retrieved. |
None |
Indicates that properties will never be expandable. |
ForceSimple |
Indicates that properties will be forced to be expandable if a custom type converter has not been specified. |
ForceAlways |
Indicates that properties will be forced to be expandable even if a custom type converter has been specified. If a custom type converter has been specified, then it will only be overridden if it does not allow the property to be expandable. |
Most properties aren't expandable, however they can be expandable if their current value has sub-properties of its own. In that case, the expandability option above governs if a property is expandable.
For the Default
case, assigning a TypeConverter
that is or inherits ExpandableTypeConverter
onto the object type will allow it to be expandable based on the expandability setting.
This code shows how to mark a class as expandable via ExpandableTypeConverter
:
Category Auto-Expansion
Categories auto-expand by default, revealing the properties within them. The Arefalse
to not auto-expand categories.
Property Auto-Expansion
Expandable properties don't auto-expand by default. The Aretrue
to auto-expand all expandable properties.
Selectively Expanding Categories or Properties
Data factories generate the data models (categories, properties, etc.) that the property grid consumes when building its user interface. The IData
There may be certain scenarios where you wish to only expand certain categories or properties. In these cases, set Arefalse
and then make a custom data factory.
In the WPF platform, the custom data factory should inherit Typetrue
.
Note that you could alternatively add this logic in a more generalized Gettrue
.