MergablePropertyAttribute.AllowMerge Eigenschap

Definitie

Hiermee wordt een waarde opgehaald die aangeeft of deze eigenschap kan worden gecombineerd met eigenschappen die behoren tot andere objecten in een venster Eigenschappen.

public:
 property bool AllowMerge { bool get(); };
public bool AllowMerge { get; }
member this.AllowMerge : bool
Public ReadOnly Property AllowMerge As Boolean

Waarde van eigenschap

true als deze eigenschap kan worden gecombineerd met eigenschappen die behoren tot andere objecten in een venster Eigenschappen; anders false.

Voorbeelden

In het volgende voorbeeld wordt gecontroleerd of MyProperty het geschikt is om samen te voegen. Eerst haalt de code de kenmerken op door MyProperty :

Vervolgens wordt de code ingesteld myAttribute op de waarde van de MergablePropertyAttribute in de AttributeCollection code en wordt gecontroleerd of de eigenschap geschikt is om samen te voegen.

// 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

Van toepassing op

Zie ook