Freigeben über


MergablePropertyAttribute.AllowMerge-Eigenschaft

Ruft einen Wert ab, der angibt, ob diese Eigenschaft in einem Eigenschaftenfenster mit Eigenschaften von anderen Objekten kombiniert werden kann.

Namespace: System.ComponentModel
Assembly: System (in system.dll)

Syntax

'Declaration
Public ReadOnly Property AllowMerge As Boolean
'Usage
Dim instance As MergablePropertyAttribute
Dim value As Boolean

value = instance.AllowMerge
public bool AllowMerge { get; }
public:
property bool AllowMerge {
    bool get ();
}
/** @property */
public boolean get_AllowMerge ()
public function get AllowMerge () : boolean

Eigenschaftenwert

true, wenn diese Eigenschaft in einem Eigenschaftenfenster mit Eigenschaften von anderen Objekten kombiniert werden kann, andernfalls false.

Beispiel

Im folgenden Beispiel wird überprüft, ob MyProperty zum Zusammenführen geeignet ist. Zunächst werden im Code die Attribute für MyProperty wie folgt abgerufen:

  • Abrufen einer PropertyDescriptorCollection mit allen Eigenschaften für das Objekt.

  • Abrufen von MyProperty über den Index in PropertyDescriptorCollection.

  • Speichern der Attribute für diese Eigenschaft in der Variablen attributes.

Anschließend wird myAttribute im Code auf den Wert von MergablePropertyAttribute in der AttributeCollection festgelegt und geprüft, ob die Eigenschaft zum Zusammenführen geeignet ist.

' 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
// 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.
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).get_Item
    ("MyPropertyProperty").get_Attributes();

// Checks to see if the property is bindable.
MergablePropertyAttribute myAttribute = 
    ((MergablePropertyAttribute)(attributes.get_Item
    (MergablePropertyAttribute.class.ToType())));

if (myAttribute.get_AllowMerge()) {
    // Insert code here.
}
// Gets the attributes for the property.
var attributes : AttributeCollection = TypeDescriptor.GetProperties(this)["MyPropertyProperty"].Attributes
       
// Checks to see if the property is bindable.
var myAttribute : MergablePropertyAttribute = MergablePropertyAttribute(attributes(MergablePropertyAttribute))
if(myAttribute.AllowMerge){
  // Insert code here.
}

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

MergablePropertyAttribute-Klasse
MergablePropertyAttribute-Member
System.ComponentModel-Namespace
MergablePropertyAttribute-Klasse
Attribute
PropertyDescriptor
AttributeCollection-Klasse
PropertyDescriptorCollection