Hello,
I'm trying to show and hide groups and single items of a PropertyGrid depending on the answers inside the same propertyGrid.
I've seen that a good place to set the visibility of the group is in when the grid is created, in this function:
private
void
RadPropertyGridOnCreateItemElement(
object
sender, CreatePropertyGridItemElementEventArgs e)
{
if
(e.Item
is
PropertyGridGroupItem groupItem)
{
var myItem = (MyItem)groupItem.Group.GroupItem.GridItems[0].Value;
groupItem.Visible = myItem.EnableGroup;
}
if
(e.Item
is
PropertyGridItem item)
{
var myItem = (MyItem)item.Value;
item.Visible = myItem.EnableItem;
}
}
However, I'm not able to change the visibility at a second time, since this function is not called again later.
If I try to change the visibility of the VisualItem in OnItemFormatting, the items are hidden, but the spaces are not recalculated and the design is messed up.
Also, if I try to change the visibility of an item at the end of OnEdited, OnItemFormatting goes on loop.
Any hint? :)
Thanks!