Expand Nested Properties Programmatically

0 Answers 118 Views
PropertyGrid
Andrew
Top achievements
Rank 1
Andrew asked on 15 Nov 2021, 09:00 PM

I'm trying to be able to expand nested properties programmatically. Specifically, I have two RadPropertyGrids next to each other for the purpose of comparing two objects and if I expand a nested property on one object I'd like to have the nested property on the other object auto-expand to keep the two views in sync. I'm trying to accomplish this by binding the IsExpanded property of the two property definitions together. This only partially works. When you click the + button to expand a nested property, the corresponding property on the other object disappears. If you click again the corresponding property reappears and they are both collapsed. If you click a third time they both expand as expected. It works correctly from then on. Just the first time is the problem.

This problem even occurs if you remove the RightGrid and just use the button to programmatically change the IsExpanded field. On the first click the property disappears completely. Subsequent clicks work as expected. If you click the + icon on the property itself it works fine.

I need to be able to set PropertyDefinition.IsExpanded programmatically at some point after the PropertyGrid is displayed. Setting it during AutoGeneratingPropertyDefinition is not an option.

I'm using version 2021.3.1109.

Dilyan Traykov
Telerik team
commented on 18 Nov 2021, 01:48 PM

This issue seems to be caused by the use of the old Hierarchical RenderMode. By changing the mode to the new recommended Flat mode, the expanding works as expected at my end:
        <telerik:RadPropertyGrid Item="{Binding }" RenderMode="Flat" Grid.Row="1" Grid.Column="0" Name="LeftGrid" NestedPropertiesVisibility="Visible" />

        <telerik:RadPropertyGrid Item="{Binding }" RenderMode="Flat" Grid.Row="1" Grid.Column="1" Name="RightGrid" NestedPropertiesVisibility="Visible"
                                 AutoGeneratingPropertyDefinition="MyGrid_OnAutoGeneratingPropertyDefinition" />

No answers yet. Maybe you can help?

Tags
PropertyGrid
Asked by
Andrew
Top achievements
Rank 1
Share this question
or