Expand C# propertygrid on show

后端 未结 4 2190
星月不相逢
星月不相逢 2020-12-18 05:07

i have a question about property grid. when the form is shown i would like a group to be expand rather then collapsed. i have search a lot for that on the web and could not

4条回答
  •  感情败类
    2020-12-18 05:56

    (Re-mixing Simon's answer above and Eric's answer below...)

    To expand all of the siblings of the SelectedGridItem:

    public static void ExpandItemWithInitialExpandedAttribute(this PropertyGrid propertyGrid)
    {
         foreach (GridItem item in propertyGrid.SelectedGridItem.Parent.GridItems)
         {
             ExpandItemWithInitialExpandedAttribute(propertyGrid, item);
         }
    }
    

提交回复
热议问题