public static void SetSelectedObject(this PropertyGrid grid, object obj, bool readOnly = false) { grid.SelectObject(obj); grid.ReadOnly = readOnly; grid.ExpandAll(); }