System.Windows.Forms.PropertyGrid Class

Provides a user interface for browsing the properties of an object.

See Also: PropertyGrid Members


[System.ComponentModel.Designer("System.Windows.Forms.Design.PropertyGridDesigner, System.Design, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
public class PropertyGrid : ContainerControl, System.Windows.Forms.ComponentModel.Com2Interop.IComPropertyBrowser


To use the property grid, you create a new instance of the System.Windows.Forms.PropertyGrid class on a parent control and set PropertyGrid.SelectedObject to the object to display the properties for.

The information displayed in the grid is a snapshot of the properties at the time the object is assigned. If a property value of the object specified by the PropertyGrid.SelectedObject is changed in code at run time, the new value is not displayed until an action is taken in the grid that causes the grid to refresh.

The property tabs within the property grid appear as buttons on the toolbar at the top of the System.Windows.Forms.PropertyGrid, and can vary in scope as defined in the System.ComponentModel.PropertyTabScope.

You can use the PropertyGrid.LargeButtons property to display large buttons instead of the default smaller ones. Large buttons are 32-by-32 pixels rather than the standard 16-by-16 pixels. The large and small buttons and the property list expander icons (the plus or minus icons) are resized according to the system DPI setting when the app.config file contains the following entry:


  <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />

The System.Windows.Forms.PropertyGrid control is not initially presented in the toolbox in the development environment. You can add a property grid to the toolbox, which enables you to drag a System.Windows.Forms.PropertyGrid onto your form. You can also define an instance of System.Windows.Forms.PropertyGrid by adding the appropriate code in your source code.

All public properties of the PropertyGrid.SelectedObject will be displayed in the System.Windows.Forms.PropertyGrid by default. You can hide a property so that it is not displayed in the System.Windows.Forms.PropertyGrid control by decorating it with the System.ComponentModel.BrowsableAttribute and setting the value to false. You can specify the category that a property appears in by providing a category with the System.ComponentModel.CategoryAttribute. You can provide descriptive text for your property that appears at the bottom of the System.Windows.Forms.PropertyGrid control by using the System.ComponentModel.DescriptionAttribute.


Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0,