This topic has not yet been rated - Rate this topic

DependencyProperty.GetMetadata method

Retrieves the property metadata value for the dependency property as registered to a type, with the type specified by a helper structure value that wraps the type name.

Syntax


public PropertyMetadata GetMetadata(
  Type forType
)

Parameters

forType

Type: System.Type [.NET] | TypeName [C++]

The name of the specific type from which to retrieve the dependency property metadata.

Return value

Type: PropertyMetadata

A property metadata object.

Remarks

Note  If you are programming using a Microsoft .NET language (C# or Microsoft Visual Basic), the TypeName type projects as System.Type. When programming using C#, it is common to use the typeof operator to get references to the System.Type of a type. In Visual Basic, use GetType.

Examples

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;
}


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

DependencyProperty
Custom dependency properties
Dependency properties overview

 

 

Build date: 1/31/2013

© 2013 Microsoft. All rights reserved.