Class PropertyMetadata
Defines certain behavior aspects of a dependency property, including conditions it was registered with.
Inherited Members
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public class PropertyMetadata
Constructors
| Improve this Doc View SourcePropertyMetadata()
Initializes a new instance of the PropertyMetadata class.
Declaration
public PropertyMetadata()
PropertyMetadata(Object)
Initializes a new instance of the PropertyMetadata class, using a property default value.
Declaration
public PropertyMetadata(object defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.Object | defaultValue | A default value for the property where this PropertyMetadata is applied. |
PropertyMetadata(Object, PropertyChangedCallback)
Initializes a new instance of the PropertyMetadata class, using a property default value and callback reference.
Declaration
public PropertyMetadata(object defaultValue, PropertyChangedCallback propertyChangedCallback)
Parameters
Type | Name | Description |
---|---|---|
System.Object | defaultValue | A default value for the property where this PropertyMetadata is applied. |
PropertyChangedCallback | propertyChangedCallback | A reference to the callback to call for property changed behavior. |
PropertyMetadata(Object, PropertyChangedCallback, CoerceValueCallback)
Initializes a new instance of the PropertyMetadata class with the specified default value and callbacks.
Declaration
public PropertyMetadata(object defaultValue, PropertyChangedCallback propertyChangedCallback, CoerceValueCallback coerceValueCallback)
Parameters
Type | Name | Description |
---|---|---|
System.Object | defaultValue | The default value of the dependency property, usually provided as a value of some specific type. |
PropertyChangedCallback | propertyChangedCallback | Reference to a handler implementation that is to be called by the property system whenever the effective value of the property changes. |
CoerceValueCallback | coerceValueCallback | Reference to a handler implementation that is to be called whenever the property system calls CoerceValue(DependencyProperty) against this property. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | defaultValue cannot be set to the value UnsetValue; |
PropertyMetadata(PropertyChangedCallback)
Initializes a new instance of the PropertyMetadata class, using a callback reference.
Declaration
public PropertyMetadata(PropertyChangedCallback propertyChangedCallback)
Parameters
Type | Name | Description |
---|---|---|
PropertyChangedCallback | propertyChangedCallback | A reference to the callback to call for property changed behavior. |
Properties
| Improve this Doc View SourceCoerceValueCallback
Gets or sets a reference to a CoerceValueCallback implementation specified in this metadata.
Declaration
public CoerceValueCallback CoerceValueCallback { get; set; }
Property Value
Type | Description |
---|---|
CoerceValueCallback | A CoerceValueCallback implementation reference. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Cannot set a metadata property once it is applied to a dependency property operation. |
DefaultValue
Gets the default value for the dependency property.
Declaration
public object DefaultValue { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The default value for the dependency property. |
Inherits
Gets or sets a value that indicates whether the value of the dependency property is inheritable.
Declaration
public bool Inherits { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the property value is inheritable; otherwise, false. The default is false. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The metadata has already been applied to a dependency property operation, so that metadata is sealed and properties of the metadata cannot be set. |
IsSealed
Gets a value that determines whether the metadata has been applied to a property in some way, resulting in the immutable state of that metadata instance.
Declaration
protected bool IsSealed { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the metadata instance is immutable; otherwise, false. |
MethodToUpdateDom
Gets the method that is called when the object is added to the visual tree, and when the property value changes while the object is already in the visual tree.
Declaration
public MethodToUpdateDom MethodToUpdateDom { get; set; }
Property Value
Type | Description |
---|---|
MethodToUpdateDom |
PropertyChangedCallback
Gets or sets a reference to a PropertyChangedCallback implementation specified in this metadata.
Declaration
public PropertyChangedCallback PropertyChangedCallback { get; set; }
Property Value
Type | Description |
---|---|
PropertyChangedCallback | A PropertyChangedCallback implementation reference. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Cannot set a metadata property once it is applied to a dependency property operation. |
Methods
| Improve this Doc View SourceMerge(PropertyMetadata, DependencyProperty)
Merges this metadata with the base metadata.
Declaration
protected virtual void Merge(PropertyMetadata baseMetadata, DependencyProperty dp)
Parameters
Type | Name | Description |
---|---|---|
PropertyMetadata | baseMetadata | The base metadata to merge with this instance's values. |
DependencyProperty | dp | The dependency property to which this metadata is being applied. |
OnApply(DependencyProperty, Type)
Called when this metadata has been applied to a property, which indicates that the metadata is being sealed.
Declaration
protected virtual void OnApply(DependencyProperty dp, Type targetType)
Parameters
Type | Name | Description |
---|---|---|
DependencyProperty | dp | The dependency property to which the metadata has been applied. |
System.Type | targetType | The type associated with this metadata if this is type-specific metadata. If this is default metadata, this value is a null reference. |