Share via


AttributeCallbackBuilder.AddCustomAttributes Method (String, array<Attribute )

Adds attributes to the member with the specified name.

Namespace:  Microsoft.Windows.Design.Metadata
Assembly:  Microsoft.Windows.Design.Extensibility (in Microsoft.Windows.Design.Extensibility.dll)

Syntax

'Declaration
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[]
)

Parameters

  • memberName
    Type: System.String
    The member to add attributes for. Only property and event members are supported; all others will be ignored.

Exceptions

Exception Condition
ArgumentNullException

memberName or attributes is nulla null reference (Nothing in Visual Basic).

Remarks

The member can be a property or an event. The member is evaluated on demand when the user queries attributes on a given property or event.

Examples

The following code example shows how to add an attribute to a member by using the AttributeCallbackBuilder class. This code example is part of a larger example provided for the AttributeCallbackBuilder class.

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

.NET Framework Security

See Also

Reference

AttributeCallbackBuilder Class

AddCustomAttributes Overload

Microsoft.Windows.Design.Metadata Namespace

AttributeTableBuilder

AddCallback

AttributeTable