共用方式為


DependencyProperty.Register 方法

定義

建立擁有特定初始化條件的 DependencyProperty 的新執行個體。

多載

Register(String, Type, Type)

初始化根據輸入參數將屬性參數化之 DependencyProperty 類別的新執行個體。

Register(String, Type, Type, PropertyMetadata)

初始化根據輸入參數將屬性參數化之 DependencyProperty 類別的新執行個體。

Register(String, Type, Type)

初始化根據輸入參數將屬性參數化之 DependencyProperty 類別的新執行個體。

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

參數

name
String

DependencyProperty 的名稱。

propertyType
Type

此屬性可包含之值的 Type

ownerType
Type

相依性屬性的 Type 擁有人。

傳回

根據輸入參數將屬性參數化之 DependencyProperty 類別。

範例

下列範例將說明如何註冊 DependencyProperty 以供 DependencyObject 使用。 此程式碼範例是 Send Email SDK 範例的一部分,而且來自 SendMailActivity.cs 檔案。 如需詳細資訊,請參閱 傳送郵件活動

// 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"))

適用於

Register(String, Type, Type, PropertyMetadata)

初始化根據輸入參數將屬性參數化之 DependencyProperty 類別的新執行個體。

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

參數

name
String

DependencyProperty 的名稱。

propertyType
Type

此屬性可包含之值的 Type

ownerType
Type

相依性屬性的 Type 擁有人。

defaultMetadata
PropertyMetadata

額外的屬性選項。

傳回

根據輸入參數將屬性參數化之 DependencyProperty 類別。

適用於