I need to set the selected item of my property grid. I'm getting an eventargs, which stores a string (this string tells me what property in my propertygrid the user wants to select).
The problem is i cannot find a collection of grid items, i can select one from. And also i dont know how to properly create a new GridItem object and set the SelectedGridItem
property.
GridItem gridItem = ???;
detailsPropertyGrid.SelectedGridItem = gridItem;
thank you for your help.
Edit:
Its almost working now tahnk you VERY much.
GridItem gi = this.detailsPropertyGrid.EnumerateAllItems().First((item) =>
item.PropertyDescriptor != null &&
item.PropertyDescriptor.Name == colName);
this.detailsPropertyGrid.SelectedGridItem = gi;
this.detailsPropertyGrid.Select();
The only problem is: Now its selecting the Property Name field. Can I set the focus to the input field of the property?