MergablePropertyAttribute.AllowMerge Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
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 :
Een met alle eigenschappen voor het object ophalen PropertyDescriptorCollection .
Indexeren in het PropertyDescriptorCollection bestand om op te halen
MyProperty.De kenmerken voor deze eigenschap opslaan in de kenmerkvariabele.
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