private static void DeviceConfigGridPostGridFocus(Object o) { PropertyGrid grid = (PropertyGrid)o; grid.Focus(); SendKeys.Send("{TAB}"); }
void EditProperty(string label) { MainPropertyGrid.Focus(); var gridItems = Helper.GetAllGridEntries(MainPropertyGrid); foreach (GridItem gridItem in gridItems) { if (gridItem.Label.Replace("\t", "") == label) { gridItem.Select(); Application.DoEvents(); break; } } MainPropertyGrid.Focus(); Application.DoEvents(); SendKeys.Send("{F4}"); Application.DoEvents(); }
public static void SelectItem(this PropertyGrid propertyGrid, string name) { if (!string.IsNullOrWhiteSpace(name)) { GridItem gi = propertyGrid.EnumerateAllItems().First((item) => item.PropertyDescriptor != null && item.PropertyDescriptor.Name == name); // select it propertyGrid.Focus(); gi.Select(); } }