System.ComponentModel (system.dll) | abstract class |
This is an abstract base class derived from
MemberDescriptor for objects that encapsulate
information about a property.
In addition to the base attribute utilities, you can determine
whether the property IsLocalizable or
IsReadOnly. You can also check the
SerializationVisibility.
ShouldSerializeValue() can be used to determine
whether the property of a particular component should be serialized.
The default implementation of this method uses
DefaultValueAttribute or a
ShouldSerialize[PropertyName] method to determine
whether it is necessary to serialize the property. See
DefaultValueAttribute for more information on
this.
You can also use ComponentType to determine the
type of the component to which this property belongs.
Converter retrieves a
TypeConverter and GetEditor()
gets a custom editor of the specified base type (in case several
types of editor are defined for the property).
AddValueChanged() and
RemoveValueChanged() allow you to bind an event
handler, to be notified when the property changes. You can use
GetValue(), SetValue(), and
ResetValue() to access and modify that value.
PropertyType indicates the type of that value.
If this is a parent property, you can retrieve the
PropertyDescriptor objects for the children with
the GetChildProperties() member.
public abstract class PropertyDescriptor : MemberDescriptor {
// Protected Constructors
protected PropertyDescriptor(MemberDescriptor descr);
protected PropertyDescriptor(MemberDescriptor descr, Attribute[] attrs);
protected PropertyDescriptor(string name, Attribute[] attrs);
// Public Instance Properties
public abstract Type ComponentType{get; }
public virtual TypeConverter Converter{get; }
public virtual bool IsLocalizable{get; }
public abstract bool IsReadOnly{get; }
public abstract Type PropertyType{get; }
public DesignerSerializationVisibility SerializationVisibility{get; }
// Public Instance Methods
public virtual void AddValueChanged(object component, EventHandler handler);
public abstract bool CanResetValue(object component);
public override bool Equals(object obj); // overrides MemberDescriptor
public PropertyDescriptorCollection GetChildProperties();
public PropertyDescriptorCollection GetChildProperties(Attribute[] filter);
public PropertyDescriptorCollection GetChildProperties(object instance);
public virtual PropertyDescriptorCollection GetChildProperties(object instance, Attribute[] filter);
public virtual object GetEditor(Type editorBaseType);
public override int GetHashCode(); // overrides MemberDescriptor
public abstract object GetValue(object component);
public virtual void RemoveValueChanged(object component, EventHandler handler);
public abstract void ResetValue(object component);
public abstract void SetValue(object component, object value);
public abstract bool ShouldSerializeValue(object component);
// Protected Instance Methods
protected object CreateInstance(Type type);
protected Type GetTypeFromName(string typeName);
protected virtual void OnValueChanged(object component, EventArgs e);
}
Hierarchy
System.Object MemberDescriptor
PropertyDescriptor
Returned By
ExtenderProvidedPropertyAttribute.ExtenderProperty,
IBindingList.SortProperty,
IComNativeDescriptorHandler.GetDefaultProperty(),
ICustomTypeDescriptor.GetDefaultProperty(),
ITypeDescriptorContext.PropertyDescriptor,PropertyDescriptorCollection.{Find(
), this},
TypeDescriptor.{CreateProperty(),
GetDefaultProperty()},
System.Windows.Forms.DataGridColumnStyle.PropertyDescriptor,
System.Windows.Forms.Design.PropertyTab.GetDefaultProperty(
),
System.Windows.Forms.GridItem.PropertyDescriptor
Passed To
Multiple types
|