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

Uses a PropertyDescriptor to expose property metadata and read or write its value.

Definition

Namespace:Telerik.WinControls.UI.PropertyGridData

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class DescriptorItemAccessor : ItemAccessor, IItemAccessor

Inheritance: objectItemAccessorDescriptorItemAccessor

Derived Classes: ImmutableItemAccessor

Implements: IItemAccessor

Inherited Members ItemAccessor.editorItemAccessor.converterItemAccessor.Owner

Constructors

Associates the descriptor with the property-grid item that represents its property.

C#
public DescriptorItemAccessor(PropertyGridItem owner, PropertyDescriptor descriptor)
Parameters:ownerPropertyGridItem

The item that uses this accessor.

descriptorPropertyDescriptor

The descriptor supplying property metadata and value access.

Properties

Gets a collection of the attributes applied to the property.

C#
public override AttributeCollection Attributes { get; }

Overrides: ItemAccessor.Attributes

Gets the descriptor category, falling back to the base accessor's default category when it is empty.

C#
public override string Category { get; }

Overrides: ItemAccessor.Category

Gets or sets the description associated with this property.

C#
public override string Description { get; }

Overrides: ItemAccessor.Description

Gets the property display name

C#
public override string DisplayName { get; }

Overrides: ItemAccessor.DisplayName

Gets the property name.

C#
public override string Name { get; }

Overrides: ItemAccessor.Name

Gets the property descriptor for this property.

C#
public override PropertyDescriptor PropertyDescriptor { get; }

Overrides: ItemAccessor.PropertyDescriptor

Gets the property type.

C#
public override Type PropertyType { get; }

Overrides: ItemAccessor.PropertyType

Gets a value indicating whether the property is editable.

C#
public override bool ReadOnly { get; }

Overrides: ItemAccessor.ReadOnly

Gets the descriptor's converter when available, otherwise using the base accessor's type-based lookup.

C#
public override TypeConverter TypeConverter { get; }

Overrides: ItemAccessor.TypeConverter

Gets the editor provided by the descriptor, falling back to the base accessor's type-based editor lookup.

C#
public override UITypeEditor UITypeEditor { get; }

Overrides: ItemAccessor.UITypeEditor

Reads or writes the descriptor value.

C#
public override object Value { get; set; }

Overrides: ItemAccessor.Value

On the direct-owner path, a read failure is returned as an Exception object, while a write failure is displayed through RadMessageBox and is not rethrown. The multi-object helpers absorb per-object errors; failed or inconsistent reads produce null, and failed writes do not display this dialog.

Methods

Reads the descriptor value from a target or resolves a common value across the selected objects.

C#
protected virtual object GetPropertyValueCore(object target)
Parameters:targetobject

The value owner, or null when a multi-object owner may be resolved.

Returns:

object

The property value; null when the descriptor is absent or selected values cannot be resolved consistently.

If the target implements ICustomTypeDescriptor, its property owner is used for the read.

Writes the descriptor value to its owner or attempts the write for each selected object in a multi-object selection.

C#
protected virtual void SetPropertyValueCore(object obj, object value)
Parameters:objobject

The value owner, or null when resolving a multi-object selection.

valueobject

The value to write.

On the direct-owner path, if the parent property is a value type or array, the updated owner is also assigned back to the parent item. The multi-object path does not perform that reassignment.