Skip to main content
A newer version of this page is available. .

Expandability Customization

  • 3 minutes to read

Overview

The PropertyGrid control allows you to customize property expandability in the following ways.

Customizing Property Expandability at the Control Level

The following PropertyGrid properties affect the expandability behavior.

Note

The PropertyDefinition.AllowExpanding property has higher precedence than the PropertyGridControl.AllowExpanding property.

The following table lists the available AllowExpanding property values and corresponding expandability modes.

AllowExpanding

property value

Property grid expandability behavior

Default

Expands properties according to their type converters.

Force

Expands all properties.

ForceIfNoTypeConverter

Expands all properties that don’t have a type converter.

Never

Properties are not expandable.

The following example demonstrates the AllowExpanding property precedence.

<Window.DataContext>
    <local:ViewModel/>
</Window.DataContext>
...
<dxprg:PropertyGridControl Grid.Column="1" SelectedObject="{Binding Data}" ShowProperties="All" AllowExpanding="Force">
    <dxprg:PropertyDefinition Path="PublicInfo"/>
    <dxprg:CollectionDefinition Path="PrivateInfo" AllowExpanding="Never"/>
</dxprg:PropertyGridControl>

PG_expandability_0

Customizing Property Expandability at the Model Level

To control property expandability from the model, use the TypeConverter attribute.

Important

A type converter affects the expandability if the AllowExpanding property is set to Default or ForceIfNoTypeConverter.

Note

To learn more about the property attributes supported by the PropertyGrid control, see Property Attributes.

<Window.DataContext>
    <local:ViewModel/>
</Window.DataContext>
...
<dxprg:PropertyGridControl Grid.Column="1" SelectedObject="{Binding Data}" ShowProperties="All" AllowExpanding="Default">

    <!--No type converter, not expandable-->
    <dxprg:PropertyDefinition Path="Simple"/>

    <dxprg:PropertyDefinition Path="Expandable"/>

    <dxprg:PropertyDefinition Path="NotExpandable"/>

    <!--No type converter, expandable-->
    <dxprg:CollectionDefinition Path="Collection"/>

</dxprg:PropertyGridControl>

PG_expandability_1

See Also