Exemple #1
0
        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();
        }
Exemple #3
0
        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();
            }
        }