DependencyObject.GetValue(DependencyProperty) 方法

定義

提供存取所指定 DependencyProperty 的值。

C#
public object GetValue (System.Workflow.ComponentModel.DependencyProperty dependencyProperty);

參數

dependencyProperty
DependencyProperty

DependencyProperty

傳回

Object

代表指定 DependencyProperty 值的物件。

範例

下列程式碼範例示範如何使用 GetValue 傳回在取得與設定的內容中,具名相依性屬性所代表的值。 此程式碼範例是傳送電子郵件 SDK 範例的一部分,來自 SendMailActivity.cs 檔案。 如需詳細資訊,請參閱 傳送電子郵件活動範例

C#
public string To
{
    get
    {
        return ((string)(base.GetValue(SendEmailActivity.ToProperty)));
    }
    set
    {
        base.SetValue(SendEmailActivity.ToProperty, value);
    }
}

[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[DescriptionAttribute("The Subject property is used to specify the subject of the Email message.")]
[CategoryAttribute(MessagePropertiesCategory)]
public string Subject
{
    get
    {
        return ((string)(base.GetValue(SendEmailActivity.SubjectProperty)));
    }
    set
    {
        base.SetValue(SendEmailActivity.SubjectProperty, value);
    }
}

[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[DescriptionAttribute("The From property is used to specify the From (Sender's) address for the email mesage.")]
[CategoryAttribute(MessagePropertiesCategory)]
public string From
{
    get
    {
        return ((string)(base.GetValue(SendEmailActivity.FromProperty)));
    }
    set
    {
        base.SetValue(SendEmailActivity.FromProperty, value);
    }
}

備註

這個成員通常用於取得屬性,以提供具名相依性值的值。

適用於

產品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8