Edit

Share via


DependencyProperty.Register Method

Definition

Creates new instances of the DependencyProperty possessing specific initialization conditions.

Overloads

Register(String, Type, Type)

Initializes a new instance of the DependencyProperty class that has the properties parameterized according to the input parameters.

Register(String, Type, Type, PropertyMetadata)

Initializes a new instance of the DependencyProperty class that has the properties parameterized according to the input parameters.

Register(String, Type, Type)

Initializes a new instance of the DependencyProperty class that has the properties parameterized according to the input parameters.

public:
 static System::Workflow::ComponentModel::DependencyProperty ^ Register(System::String ^ name, Type ^ propertyType, Type ^ ownerType);
public static System.Workflow.ComponentModel.DependencyProperty Register (string name, Type propertyType, Type ownerType);
static member Register : string * Type * Type -> System.Workflow.ComponentModel.DependencyProperty
Public Shared Function Register (name As String, propertyType As Type, ownerType As Type) As DependencyProperty

Parameters

name
String

The name of the DependencyProperty.

propertyType
Type

Type of the value that the property can contain.

ownerType
Type

Owner Type of the dependency property.

Returns

The DependencyProperty class that has the properties parameterized according to the input parameters.

Examples

The following example shows how to register a DependencyProperty for use by a DependencyObject. This code example is part of the Send Email SDK Sample and is from the SendMailActivity.cs file. For more information, see Send Mail Activity.

// Define the DependencyProperty objects for all of the Properties
// ...and Events exposed by this activity
public static DependencyProperty FromProperty = DependencyProperty.Register("From", typeof(string), typeof(SendEmailActivity), new PropertyMetadata("someone@example.com"));
public static DependencyProperty ToProperty = DependencyProperty.Register("To", typeof(string), typeof(SendEmailActivity), new PropertyMetadata("someone@example.com"));
' Define the DependencyProperty objects for all of the Properties 
' ...and Events exposed by me activity
Public Shared FromEmailProperty As DependencyProperty = DependencyProperty.Register("From", GetType(String), GetType(SendEmailActivity), New PropertyMetadata("someone@example.com"))
Public Shared ToProperty As DependencyProperty = DependencyProperty.Register("To", GetType(String), GetType(SendEmailActivity), New PropertyMetadata("someone@example.com"))

Applies to

Register(String, Type, Type, PropertyMetadata)

Initializes a new instance of the DependencyProperty class that has the properties parameterized according to the input parameters.

public:
 static System::Workflow::ComponentModel::DependencyProperty ^ Register(System::String ^ name, Type ^ propertyType, Type ^ ownerType, System::Workflow::ComponentModel::PropertyMetadata ^ defaultMetadata);
public static System.Workflow.ComponentModel.DependencyProperty Register (string name, Type propertyType, Type ownerType, System.Workflow.ComponentModel.PropertyMetadata defaultMetadata);
static member Register : string * Type * Type * System.Workflow.ComponentModel.PropertyMetadata -> System.Workflow.ComponentModel.DependencyProperty
Public Shared Function Register (name As String, propertyType As Type, ownerType As Type, defaultMetadata As PropertyMetadata) As DependencyProperty

Parameters

name
String

The name of the DependencyProperty.

propertyType
Type

Type of the value the property can contain.

ownerType
Type

Owner Type of the dependency property.

defaultMetadata
PropertyMetadata

Additional property options.

Returns

The DependencyProperty class that has the properties parameterized according to the input parameters.

Applies to