DependencyProperty.GetMetadata(TypeName) Method


Retrieves the property metadata value for the dependency property as registered to a type. You specify the type you want info from as a type reference.

PropertyMetadata GetMetadata(TypeName const& forType);
public PropertyMetadata GetMetadata(System.Type forType);
function getMetadata(forType)
Public Function GetMetadata (forType As Type) As PropertyMetadata


TypeName Type

The name of the specific type from which to retrieve the dependency property metadata, as a type reference (System.Type for Microsoft .NET, a TypeName helper struct for Visual C++ component extensions (C++/CX)).


A property metadata object.


This example implements a utility method that reports the default value of a given dependency property as it exists in FrameworkElement, based on the default value registered and stored in the metadata.

public static object GetDefaultValueForFrameworkDP(DependencyProperty dpIdentifier)
    PropertyMetadata metadataInfo = dpIdentifier.GetMetadata(typeof(FrameworkElement));
    return metadataInfo.DefaultValue;

Applies to

See also