Share via


AttributeCallbackBuilder.AddCustomAttributes メソッド (String, array<Attribute )

指定した名前のメンバーに属性を追加します。

名前空間:  Microsoft.Windows.Design.Metadata
アセンブリ:  Microsoft.Windows.Design.Extensibility (Microsoft.Windows.Design.Extensibility.dll 内)

構文

'宣言
Public Sub AddCustomAttributes ( _
    memberName As String, _
    ParamArray attributes As Attribute() _
)
public void AddCustomAttributes(
    string memberName,
    params Attribute[] attributes
)
public:
void AddCustomAttributes(
    String^ memberName, 
    ... array<Attribute^>^ attributes
)
member AddCustomAttributes : 
        memberName:string * 
        attributes:Attribute[] -> unit 
public function AddCustomAttributes(
    memberName : String, 
    ... attributes : Attribute[]
)

パラメーター

  • memberName
    型: System.String
    属性を追加するメンバー。サポートされるメンバーはプロパティとイベントだけです。その他のメンバーはすべて無視されます。
  • attributes
    型: array<System.Attribute[]
    追加する新しい属性の配列。

例外

例外 条件
ArgumentNullException

memberName または attributes が nullnull 参照 (Visual Basic では Nothing) です。

解説

メンバーとして、プロパティまたはイベントを指定できます。 メンバーの評価は、ユーザーが特定のプロパティまたはイベントの属性を照会したときに、要求に応じて行われます。

AttributeCallbackBuilder クラスを使用して、属性をメンバーに追加する方法を次のコード例に示します。 次のコード例は、AttributeCallbackBuilder クラス用のより大きなコード例の一部です。

// Apply the ReadOnlyAttribute to the Background property 
// of the Button class.
callbackBuilder.AddCustomAttributes(
    "Background",
    new ReadOnlyAttribute(true));

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

AttributeCallbackBuilder クラス

AddCustomAttributes オーバーロード

Microsoft.Windows.Design.Metadata 名前空間

AttributeTableBuilder

AddCallback

AttributeTable