MergablePropertyAttribute.AllowMerge Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient une valeur indiquant si cette propriété peut être combinée avec des propriétés appartenant à d’autres objets dans une fenêtre Propriétés.
public:
property bool AllowMerge { bool get(); };
public bool AllowMerge { get; }
member this.AllowMerge : bool
Public ReadOnly Property AllowMerge As Boolean
Valeur de propriété
true si cette propriété peut être combinée avec des propriétés appartenant à d’autres objets dans un Fenêtre Propriétés ; sinon, false.
Exemples
L’exemple suivant vérifie s’il MyProperty convient de fusionner. Tout d’abord, le code obtient les attributs pour MyProperty :
Récupération d’une PropertyDescriptorCollection propriété avec toutes les propriétés de l’objet.
Indexation dans l’index PropertyDescriptorCollection pour obtenir
MyProperty.Enregistrement des attributs pour cette propriété dans la variable d’attributs.
Ensuite, le code définit myAttribute la valeur de l’élément MergablePropertyAttribute dans le AttributeCollection fichier et vérifie si la propriété est appropriée pour fusionner.
// 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