2010-11-20 70 views
2

我在一些自定義用戶控件中定義了一些DependencyProperties。我希望Visual Studio(和Blend作爲獎勵)在「可見性」類別下列出這些屬性,而不是「其他」或「其他」。如何在「可見性」類別下而不是「其他」下聲明DependencyProperty?

如何向這些屬性添加一些元數據以實現此目的?

編輯:爲了澄清我的問題,我想我想要的「正常」的get/set屬性顯示出來,並沒有真正的靜態依賴屬性本身,所以作爲一個例子,我想組的屬性是ConnectorLabelText

public string ConnectorLabelText 
{ 
    get { return (string)GetValue(ConnectorLabelTextProperty); } 
    set { SetValue(ConnectorLabelTextProperty, value); } 
} 

// Using a DependencyProperty as the backing store for ConnectorLabelText. This enables animation, styling, binding, etc... 
public static readonly DependencyProperty ConnectorLabelTextProperty = 
    DependencyProperty.Register("ConnectorLabelText", typeof(string), typeof(InputConnector), new UIPropertyMetadata("IN")); 

回答

3

this問題

添加一個例子

[Description("My Description"), Category("Visibility")] 
public string ConnectorLabelText 
{ 
    get { return (string)GetValue(ConnectorLabelTextProperty); } 
    set { SetValue(ConnectorLabelTextProperty, value); } 
} 
+0

D'哦,謝謝 - 在這個錯誤的術語上搜了一下:( – Brandon 2010-11-20 19:52:04

+0

嘿嘿沒有問題:)這很容易發生 – 2010-11-20 20:00:37

相關問題