New to Telerik UI for WinForms? Start a free 30-day trial

Represents a property or nested member displayed as a row in the PropertyGrid.

The item's accessor supplies its property metadata and value; nested properties are exposed through GridItems.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class PropertyGridItem : PropertyGridItemBase, INotifyPropertyChanged, IDataItem, ITypeDescriptorContext, IServiceProvider

Inheritance: objectPropertyGridItemBasePropertyGridItem

Implements: IDataItemINotifyPropertyChangedIServiceProviderITypeDescriptorContext

Inherited Members PropertyGridItemBase.SuspendNotificationsStatePropertyGridItemBase.IsExpandedStatePropertyGridItemBase.IsVisibleStatePropertyGridItemBase.IsEnableStatePropertyGridItemBase.IsModifiedStatePropertyGridItemBase.statePropertyGridItemBase.textPropertyGridItemBase.Expand()PropertyGridItemBase.Collapse()PropertyGridItemBase.EnsureVisible()PropertyGridItemBase.Select()PropertyGridItemBase.SetBooleanProperty(string, int, bool)PropertyGridItemBase.Update(PropertyGridTableElement.UpdateActions)PropertyGridItemBase.SuspendPropertyNotifications()PropertyGridItemBase.ResumePropertyNotifications()PropertyGridItemBase.OnNotifyPropertyChanged(string)PropertyGridItemBase.OnNotifyPropertyChanged(PropertyChangedEventArgs)PropertyGridItemBase.PropertyGridTableElementPropertyGridItemBase.VisiblePropertyGridItemBase.SelectedPropertyGridItemBase.ExpandedPropertyGridItemBase.EnabledPropertyGridItemBase.ItemHeightPropertyGridItemBase.ImagePropertyGridItemBase.ImageIndexPropertyGridItemBase.ImageKeyPropertyGridItemBase.ToolTipTextPropertyGridItemBase.ContextMenuPropertyGridItemBase.TagPropertyGridItemBase.LevelPropertyGridItemBase.PropertyChanged...

Constructors

Creates an item associated with the specified table element and parent item.

C#
public PropertyGridItem(PropertyGridTableElement propertyGridElement, PropertyGridItem parentItem)
Parameters:propertyGridElementPropertyGridTableElement

The table element that owns the item.

parentItemPropertyGridItem

The parent item, or null for a root-level item.

Creates a root-level item associated with the specified table element.

C#
public PropertyGridItem(PropertyGridTableElement propertyGridElement)
Parameters:propertyGridElementPropertyGridTableElement

The table element that owns the item.

Fields

Cached value returned by Value when the owning table uses cached values.

C#
protected object cachedValue

Properties

Gets the item accessor for this property item.

C#
public IItemAccessor Accessor { get; }

Gets a collection of the attributes applied to the property.

C#
public virtual AttributeCollection Attributes { get; }

Gets the category of the property from its CategoryAttribute or returns "Other" if no category is specified.

C#
public virtual string Category { get; }

Gets the container of the control hosting this item, when the control has a site.

C#
public IContainer Container { get; }
Property Value:

The host control's component container, or null if the item is not hosted by a sited control.

Implements: ITypeDescriptorContext.Container

Gets or sets the object stored in the DataBoundItem slot.

C#
public object DataBoundItem { get; set; }

Implements: IDataItem.DataBoundItem

Setting this property also replaces the item's accessor with a descriptor accessor created from the value when it is a PropertyDescriptor. Other value types leave that accessor without a descriptor.

Gets or sets whether the stored sort order is a grid-assigned default that may be replaced by a RadSortOrderAttribute value.

C#
public bool DefaultSortOrder { get; set; }

When SortOrder is read while an accessor is available, the attribute is checked and this flag is cleared.

Gets or sets the description associated with this item.

C#
public override string Description { get; set; }

Overrides: PropertyGridItemBase.Description

Gets or sets an error message to be displayed when property value validation fails.

C#
public virtual string ErrorMessage { get; set; }

Gets a value indicating whether this is a complex property.

C#
public override bool Expandable { get; }

Overrides: PropertyGridItemBase.Expandable

Gets the fixed field count reported to IDataItem consumers.

C#
public int FieldCount { get; }
Property Value:

Always 8; this count is not derived from the public properties exposed by the indexers.

Implements: IDataItem.FieldCount

Gets the value of the property as a string using its TypeConverter.

C#
public virtual string FormattedValue { get; set; }

Gets the sub items of the current if it is composed of several sub-items.

C#
public override PropertyGridItemCollection GridItems { get; }

Overrides: PropertyGridItemBase.GridItems

Gets the object that owns this item's value, falling back to the parent item's instance when necessary.

C#
public object Instance { get; }

Implements: ITypeDescriptorContext.Instance

Gets a value indicating whether the property value is modified.

C#
public virtual bool IsModified { get; }

Gets or sets a value defining whether check box editor will be three state.

C#
public virtual bool IsThreeState { get; set; }

Gets or sets the text that would be displayed for this property.

C#
public override string Label { get; set; }

Overrides: PropertyGridItemBase.Label

Gets the property name

C#
public override string Name { get; }

Overrides: PropertyGridItemBase.Name

Gets the original property value.

C#
public virtual object OriginalValue { get; }

Gets or sets the parent of this item.

C#
public override PropertyGridItemBase Parent { get; }

Overrides: PropertyGridItemBase.Parent

Gets the property descriptor for this property.

C#
public virtual PropertyDescriptor PropertyDescriptor { get; }

Implements: ITypeDescriptorContext.PropertyDescriptor

Gets the property type

C#
public virtual Type PropertyType { get; }

Gets a value indicating whether the property is read only.

C#
public virtual bool ReadOnly { get; }

Gets or sets a value defining the sort order of the item when no other sorting is applied.

C#
public virtual int SortOrder { get; set; }

Gets the value of a public instance property by its reflection enumeration index.

C#
public object this[int index] { get; set; }
Parameters:indexint

The zero-based index in the public instance property list.

Property Value:

The property value, or null when the index is greater than or equal to the property count.

Exceptions: IndexOutOfRangeException

The index is negative.

Implements: IDataItem.this[int]

The setter does not assign a property value, and the index order is supplied by reflection.

Gets the value of a public instance property by name.

C#
public object this[string name] { get; set; }
Parameters:namestring

The case-sensitive property name.

Property Value:

The property value, or null if no matching public instance property exists.

Implements: IDataItem.this[string]

The setter does not assign a property value.

Gets the TypeConverter associated with this property

C#
public virtual TypeConverter TypeConverter { get; }

Gets the UITypeEditor associated with this property

C#
public virtual UITypeEditor UITypeEditor { get; }

Gets or sets the item value.

C#
public virtual object Value { get; set; }
Property Value:

The underlying property value read from or written through this item's accessor.

Methods

Selects this item and puts the Property grid in edit mode.

C#
public virtual void BeginEdit()

Converts a string into a password string.

C#
protected virtual string ConvertToPasswordString(string input)
Parameters:inputstring

The input.

Returns:

string

Gets the child items for a given item.

C#
protected virtual PropertyGridItemCollection GetChildItems(PropertyGridItem parentItem, object obj, Type objType)
Parameters:parentItemPropertyGridItem

The parent item for which to get the child items.

objobject

The instance of the item.

objTypeType

The type of the property.

Returns:

PropertyGridItemCollection

Collection of PropertyGridItem

Resolves this item or one of its ancestors as a service.

C#
public object GetService(Type serviceType)
Parameters:serviceTypeType

The requested service type.

Returns:

object

This item when serviceType is PropertyGridItem; otherwise, the first service returned by a parent, or null.

Implements: IServiceProvider.GetService(Type)

Finds a public instance property by name in the same reflection order used by the integer indexer.

C#
public int IndexOf(string name)
Parameters:namestring

The case-sensitive property name to find.

Returns:

int

The property's zero-based reflection index, or -1 if no matching property exists.

Implements: IDataItem.IndexOf(string)

Does nothing; this context does not forward the change notification to an IComponentChangeService.

C#
public void OnComponentChanged()

Implements: ITypeDescriptorContext.OnComponentChanged()

Returns true without consulting an IComponentChangeService.

C#
public bool OnComponentChanging()
Returns:

bool

Always true.

Implements: ITypeDescriptorContext.OnComponentChanging()

Resets the property value to its default value.

C#
public virtual void ResetValue()

Associates this item with its parent for hierarchy and value-owner resolution.

C#
protected virtual void SetParent(PropertyGridItem parent)
Parameters:parentPropertyGridItem

The parent item, or null for a root-level item.

Determines if the item should update its child items based on the types of the old value and the new one.

C#
protected virtual bool ShouldGetChildItemsAnew(object oldValue, object newValue)
Parameters:oldValueobject

The old value of this item.

newValueobject

The new value of this item.

Returns:

bool

True if child items should be updated otherwise false.

Gets the default value of the current item. A return parameter determines if the operation succeeded.

C#
protected virtual bool TryGetDefaultValue(out object value)
Parameters:valueobject

An object where the default value will be stored if there is such.

Returns:

bool

True if the item has a default value otherwise false.