ExpandablePropertiesConverter Class

Provides a type converter that allows expanding the properties recursively in a PropertyGrid. This class is similar to System.ComponentModel.ExpandableObjectConverter, but that one allows expanding the top-level properties only.

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
C#
public class ExpandablePropertiesConverter : TypeConverter
Inheritance
Object    TypeConverter    ExpandablePropertiesConverter

Remarks

This can be used to decorate properties by TypeConverterAttribute. Alternatively, you can use the RecursivelyEditableTypeDescriptor to wrap any object to make its properties expandable in a PropertyGrid.

  Tip

To load/save object graphs that are recursively editable in a PropertyGrid, you can use the XmlSerializer class from the KGy SOFT Core Libraries package.

Examples

To make a property recursively expandable in a PropertyGrid, use the TypeConverterAttribute:
C#
[TypeConverter(typeof(ExpandablePropertiesConverter))]
public MyComplexType MyComplexProperty { get; set; }

Constructors

ExpandablePropertiesConverterInitializes a new instance of the ExpandablePropertiesConverter class

Methods

GetPropertiesReturns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.
(Overrides TypeConverterGetProperties(ITypeDescriptorContext, Object, Attribute))
GetPropertiesSupportedReturns whether this object supports properties, using the specified context.
(Overrides TypeConverterGetPropertiesSupported(ITypeDescriptorContext))

See Also