Grouping Support
RadPropertyGrid supports grouping. Its IsGrouped property controls the current RadPropertyGrid's state. You can set it to true and you will have RadPropertyGrid initially grouped. If you set it to false, then you will have RadProperty sorted. By default the control is shown as sorted.
Please note all the groups will be auto expanded. In case you want to initially collapse a group, you can do this once RadPropertyGrid is loaded using a Dispatcher. Please refer to the Expand/Collapse Groups section below.
Another property you can configure is SortAndGroupButtonsVisibility. It sets the visibility mode of the sort and group buttons. By default the buttons will be visible.
For example, lets have the following declaration of the RadPropertyGrid control:
Example 1: Declaring RadPropertyGrid
Its Item is set like so:
Example 2: Setting RadPropertyGrid Item
Now, if you run your application, you will see this result:
Expand/Collapse Groups
The user can control the group state from the UI.
He can also collapse and expand groups in RadPropertyGrid in code using its methods:
- ExpandGroup(object GroupKey): Sets expand state for the given GroupDefinition
Example 3: Expanding RadPropertyGrid Group
- CollapseGroup(object GroupKey): Collapses the visual group for the given GroupDefinition
Example 4: Collapsing RadPropertyGrid Group
- ExpandAllGroups(): Expands all groups recursively
Example 5: Expanding all RadPropertyGrid Groups
- CollapseAllGroups(): Collapses all groups recursively.
Example 6: Collapsing all RadPropertyGrid Groups
You need to set RenderMode="Flat" in order to be able to execute the methods above. For more information check Layout Rendering Modes.
GroupDefinitions
The GroupDefinitions property gets a collection of GroupDefinition objects used to group RadPropertyGrid.
It has two methods:
SuspendNotifications(): Suspends the notifications.
ResumeNotifications(): Resumes the notifications.
Example 7: Suspending and Resuming notifications
You need to set RenderMode="Flat" in order to be able to work with the GroupDefinitions collection. For more information check Layout Rendering Modes.
AutoExpandGroups
As of R2 2019, the RadPropertyGrid control exposes a new boolean property - AutoExpandGroups. It controls whether groups should be expanded or not when loaded. The default value is True meaning that all groups are initially expanded.