MergablePropertyAttribute.AllowMerge Vlastnost

Definice

Získá hodnotu určující, zda tato vlastnost lze kombinovat s vlastnostmi patřícími do jiných objektů v okně Vlastnosti.

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

Hodnota vlastnosti

true, pokud lze tuto vlastnost kombinovat s vlastnostmi patřícími do jiných objektů v okno Vlastnosti; jinak false.

Příklady

Následující příklad zkontroluje, zda MyProperty je vhodné sloučit. Nejprve kód získá atributy pro MyProperty :

Kód se pak nastaví myAttribute na hodnotu v objektu MergablePropertyAttributeAttributeCollection a zkontroluje, zda je vlastnost vhodná ke sloučení.

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

Platí pro

Viz také