Show / Hide Table of Contents

Class PropertyMetadata

Defines certain behavior aspects of a dependency property, including conditions it was registered with.

Inheritance
System.Object
PropertyMetadata
FrameworkPropertyMetadata
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public class PropertyMetadata

Constructors

| Improve this Doc View Source

PropertyMetadata()

Initializes a new instance of the PropertyMetadata class.

Declaration
public PropertyMetadata()
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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;

| Improve this Doc View Source

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 Source

CoerceValueCallback

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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
| Improve this Doc View Source

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 Source

Merge(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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source