MergablePropertyAttribute.AllowMerge Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
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:
Recupero di un PropertyDescriptorCollection oggetto con tutte le proprietà per l'oggetto .
Indicizzazione in PropertyDescriptorCollection per ottenere
MyProperty.Salvataggio degli attributi per questa proprietà nella variabile degli attributi.
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