MergablePropertyAttribute.AllowMerge Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value indicating whether this property can be combined with properties belonging to other objects in a Properties window.
public:
property bool AllowMerge { bool get(); };
public bool AllowMerge { get; }
member this.AllowMerge : bool
Public ReadOnly Property AllowMerge As Boolean
Property Value
true
if this property can be combined with properties belonging to other objects in a Properties window; otherwise, false
.
Examples
The following example checks to see whether MyProperty
is appropriate to merge. First the code gets the attributes for MyProperty
by:
Retrieving a PropertyDescriptorCollection with all the properties for the object.
Indexing into the PropertyDescriptorCollection to get
MyProperty
.Saving the attributes for this property in the attributes variable.
Then the code sets myAttribute
to the value of the MergablePropertyAttribute in the AttributeCollection and checks whether the property is appropriate to merge.
// Gets the attributes for the property.
AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyPropertyProperty" ]->Attributes;
// Checks to see if the property is bindable.
MergablePropertyAttribute^ myAttribute = dynamic_cast<MergablePropertyAttribute^>(attributes[ MergablePropertyAttribute::typeid ]);
if ( myAttribute->AllowMerge )
{
// Insert code here.
}
// 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.
}
' 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