Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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