Name

GridItem

Synopsis

This class represents a particular row in a PropertyGrid and is used in the PropertyGrid.SelectedGridItem and PropertyGrid.SelectedGridItemChanged members.

You can discover whether the row is Expandable (and whether it is Expanded), which GridItems are children of this one, and which is its Parent.

The Label and Value can be retrieved (but not set) through those properties, and you can also retrieve the PropertyDescriptor for the item, to discover what type the item Value might be and which System.ComponentModel.TypeConverter is available for it.

The Select() method causes the row represented by this object to be selected in the PropertyGrid.

The GridItemType property is used to determine whether this row in the grid represents an ArrayValue, a Category line (e.g., the Behavior, Layout labels), a simple Property, or a Root item for an expandable row.


public abstract class GridItem {

// Protected Constructors

   protected GridItem();

// Public Instance Properties

   public virtual bool Expandable{get; }

   public virtual bool Expanded{set; get; }

   public abstract GridItemCollection GridItems{get; }

   public abstract GridItemType GridItemType{get; }

   public abstract string Label{get; }

   public abstract GridItem Parent{get; }

   public abstract PropertyDescriptor PropertyDescriptor{get; }

   public abstract object Value{get; }

// Public Instance Methods

   public abstract bool Select();

}

Returned By

GridItemCollection.this, PropertyGrid.SelectedGridItem, PropertyValueChangedEventArgs.ChangedItem ...

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.