This documentation is archived and is not being maintained.

MergablePropertyAttribute.AllowMerge Property

Gets a value indicating whether this property can be combined with properties belonging to other objects in a Properties window.

[Visual Basic]
Public ReadOnly Property AllowMerge As Boolean
[C#]
public bool AllowMerge {get;}
[C++]
public: __property bool get_AllowMerge();
[JScript]
public function get AllowMerge() : Boolean;

Property Value

true if this property can be combined with properties belonging to other objects in a Properties window; otherwise, false.

Example

The following example checks to see whether MyProperty is appropriate to merge. First the code gets the attributes for MyProperty by:

Then the code sets myAttribute to the value of the MergablePropertyAttribute in the AttributeCollection and checks whether the property is appropriate to merge.

[Visual Basic] 
' Gets the attributes for the property.
Dim attributes As AttributeCollection = _
   TypeDescriptor.GetProperties(Me)("MyPropertyProperty").Attributes
       
' Checks to see if the property is bindable.
Dim myAttribute As MergablePropertyAttribute = _
   CType(attributes(GetType(MergablePropertyAttribute)), _
   MergablePropertyAttribute)
If myAttribute.AllowMerge Then
    ' Insert code here.
End If


[C#] 
// Gets the attributes for the property.
AttributeCollection attributes = 
   TypeDescriptor.GetProperties(this)["MyPropertyProperty"].Attributes;

// Checks to see if the property is bindable.
MergablePropertyAttribute myAttribute = (MergablePropertyAttribute)attributes[typeof(MergablePropertyAttribute)];
if(myAttribute.AllowMerge) {
   // Insert code here.
}


[C++] 
// Gets the attributes for the property.
AttributeCollection* attributes = 
   TypeDescriptor::GetProperties(this)->Item[S"MyPropertyProperty"]->Attributes;

// Checks to see if the property is bindable.
MergablePropertyAttribute* myAttribute = dynamic_cast<MergablePropertyAttribute*>(attributes->Item[__typeof(MergablePropertyAttribute)]);
if(myAttribute->AllowMerge) {
   // Insert code here.
}


[JScript] 
// Gets the attributes for the property.
var attributes : AttributeCollection = TypeDescriptor.GetProperties(this)["MyPropertyProperty"].Attributes
       
// Checks to see if the property is bindable.
var myAttribute : MergablePropertyAttribute = MergablePropertyAttribute(attributes(MergablePropertyAttribute))
if(myAttribute.AllowMerge){
  // Insert code here.
}

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

MergablePropertyAttribute Class | MergablePropertyAttribute Members | System.ComponentModel Namespace | MergablePropertyAttribute | Attribute | PropertyDescriptor | AttributeCollection | PropertyDescriptorCollection

Show: