AttributeCallbackBuilder.AddCustomAttributes Method (String, array<Attribute[])

Adds attributes to the member with the specified name.

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

Syntax

'Declaration
Public Sub AddCustomAttributes ( _
    memberName As String, _
    ParamArray attributes As Attribute() _
)
'Usage
Dim instance As AttributeCallbackBuilder 
Dim memberName As String 
Dim attributes As Attribute()

instance.AddCustomAttributes(memberName, _
    attributes)
public void AddCustomAttributes(
    string memberName,
    params Attribute[] attributes
)
public:
void AddCustomAttributes(
    String^ memberName, 
    ... array<Attribute^>^ attributes
)
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

AttributeCallbackBuilder Members

AddCustomAttributes Overload

Microsoft.Windows.Design.Metadata Namespace

AttributeTableBuilder

AddCallback

AttributeTable

Other Resources

Metadata Store