Construtor ToolboxBrowsableAttribute

Initializes a new instance of the ToolboxBrowsableAttribute class.

Namespace:  Microsoft.Windows.Design
Assembly:  Microsoft.Windows.Design.Interaction (em Microsoft.Windows.Design.Interaction.dll)

Sintaxe

'Declaração
Public Sub New ( _
    browsable As Boolean _
)
public ToolboxBrowsableAttribute(
    bool browsable
)
public:
ToolboxBrowsableAttribute(
    bool browsable
)
new : 
        browsable:bool -> ToolboxBrowsableAttribute
public function ToolboxBrowsableAttribute(
    browsable : boolean
)

Parâmetros

  • browsable
    Tipo: System.Boolean
    true Para ativar a visibilidade de um controle em um navegador da caixa de ferramentas; Caso contrário, false.

Exemplos

O exemplo de código a seguir mostra como usar o ToolboxBrowsableAttribute para ativar a visibilidade de um controle personalizado no navegador de caixa de ferramentas. do designer

' Container for any general design-time metadata to initialize.
' Designers look for a type in the design-time assembly that 
' implements IProvideAttributeTable. If found, designers instantiate
' this class and access its AttributeTable property automatically.
Friend Class Metadata
    Implements IProvideAttributeTable

    ' Accessed by the designer to register any design-time metadata.
    Public ReadOnly Property AttributeTable() As AttributeTable _
        Implements IProvideAttributeTable.AttributeTable
        Get
            Dim builder As New AttributeTableBuilder()

            builder.AddCustomAttributes( _
                GetType(ButtonWithDesignTime), _
                New ToolboxBrowsableAttribute(True))

            Return builder.CreateTable()
        End Get
    End Property

End Class
// Container for any general design-time metadata to initialize.
// Designers look for a type in the design-time assembly that 
// implements IProvideAttributeTable. If found, designers instantiate 
// this class and access its AttributeTable property automatically.
internal class Metadata : IProvideAttributeTable
{
    // Accessed by the designer to register any design-time metadata.
    public AttributeTable AttributeTable
    {
        get 
        {
            AttributeTableBuilder builder = new AttributeTableBuilder();

            builder.AddCustomAttributes(
                typeof(ButtonWithDesignTime),
                new ToolboxBrowsableAttribute(true));

            return builder.CreateTable();
        }
    }
}

Segurança do .NET Framework

Consulte também

Referência

ToolboxBrowsableAttribute Classe

Namespace Microsoft.Windows.Design

AttributeTableBuilder

Outros recursos

Walkthrough: Criando um adorno em tempo de design