MergablePropertyAttribute.AllowMerge Proprietà

Definizione

Ottiene un valore che indica se questa proprietà può essere combinata con proprietà appartenenti ad altri oggetti in una finestra Proprietà.

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

Valore della proprietà

true se questa proprietà può essere combinata con proprietà appartenenti ad altri oggetti in un Finestra Proprietà; in caso contrario, false.

Esempio

Nell'esempio seguente viene verificato se MyProperty è appropriato eseguire l'unione. Prima di tutto, il codice ottiene gli attributi per MyProperty per:

Il codice imposta myAttribute quindi sul valore di MergablePropertyAttribute in AttributeCollection e controlla se la proprietà è appropriata per l'unione.

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

Si applica a

Vedi anche