MergablePropertyAttribute.AllowMerge Propriedade

Definição

Obtém um valor que indica se essa propriedade pode ser combinada com propriedades pertencentes a outros objetos em uma janela Propriedades.

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

Valor da propriedade

true se essa propriedade puder ser combinada com propriedades pertencentes a outros objetos em um janela Propriedades; caso contrário, false.

Exemplos

O exemplo a seguir verifica se MyProperty é apropriado mesclar. Primeiro, o código obtém os atributos para MyProperty :

Em seguida, o código define myAttribute como o valor do MergablePropertyAttribute in AttributeCollection e verifica se a propriedade é apropriada para mesclar.

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

Aplica-se a

Confira também