Register Method (String, Type, Type, PropertyMetadata, ValidateValueCallback)

DependencyProperty::Register Method (String^, Type^, Type^, PropertyMetadata^, ValidateValueCallback^)


Registers a with the specified property name, property type, owner type, property metadata, and a value validation callback for the property. GTMT

Namespace:   System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

static DependencyProperty^ Register(
	String^ name,
	Type^ propertyType,
	Type^ ownerType,
	PropertyMetadata^ typeMetadata,
	ValidateValueCallback^ validateValueCallback


Type: System::String^

The name of the dependency property to register.

Type: System::Type^

The type of the property.

Type: System::Type^

The owner type that is registering the dependency property.

Type: System.Windows::PropertyMetadata^

Property metadata for the dependency property.

Type: System.Windows::ValidateValueCallback^

A reference to a callback that should perform any custom validation of the dependency property value beyond typical type validation.

Return Value

Type: System.Windows::DependencyProperty^

A dependency property identifier that should be used to set the value of a public static readonly field in your class. That identifier is then used to reference the dependency property later, for operations such as setting its value programmatically or obtaining metadata.

For more information on dependency property registration, see DependencyProperty.

The following example registers a dependency property, including a validation callback (the callback definition is not shown; for details on the callback definition, see ValidateValueCallback).

.NET Framework
Available since 3.0
Return to top
© 2015 Microsoft