MergablePropertyAttribute.AllowMerge Vlastnost

Definice

Získá hodnotu označující, zda lze tuto vlastnost zkombinovat s vlastnostmi patřícími do jiných objektů v okno Vlastnosti.

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

Hodnota vlastnosti

truepokud lze tuto vlastnost kombinovat s vlastnostmi patřícími k jiným objektům v okno Vlastnosti; v opačném případě false.

Příklady

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

Pak kód nastaví myAttribute hodnotu MergablePropertyAttribute v AttributeCollection 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é