Classe ToolboxBrowsableAttribute
Especifica se um controle é visível no navegador de caixa de ferramentas do designer.
Hierarquia de herança
System.Object
System.Attribute
Microsoft.Windows.Design.ToolboxBrowsableAttribute
Namespace: Microsoft.Windows.Design
Assembly: Microsoft.Windows.Design.Interaction (em Microsoft.Windows.Design.Interaction.dll)
Sintaxe
'Declaração
<AttributeUsageAttribute(AttributeTargets.Class)> _
Public NotInheritable Class ToolboxBrowsableAttribute _
Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class)]
public sealed class ToolboxBrowsableAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)]
public ref class ToolboxBrowsableAttribute sealed : public Attribute
[<Sealed>]
[<AttributeUsageAttribute(AttributeTargets.Class)>]
type ToolboxBrowsableAttribute =
class
inherit Attribute
end
public final class ToolboxBrowsableAttribute extends Attribute
O tipo ToolboxBrowsableAttribute expõe os membros a seguir.
Construtores
Nome | Descrição | |
---|---|---|
![]() |
ToolboxBrowsableAttribute | Initializes a new instance of the ToolboxBrowsableAttribute class. |
Início
Propriedades
Nome | Descrição | |
---|---|---|
![]() |
Browsable | Obtém o Browsable sinalizador associado com esse atributo. |
![]() ![]() |
No | Gets a ToolboxBrowsableAttribute with Browsable set to false. |
![]() |
TypeId | Quando implementado em uma classe derivada, obtém um identificador exclusivo para este Attribute. (Herdado de Attribute.) |
![]() ![]() |
Yes | Gets a ToolboxBrowsableAttribute with Browsable set to true. |
Início
Métodos
Nome | Descrição | |
---|---|---|
![]() |
Equals | Infraestrutura. Returns a value that indicates whether this instance is equal to a specified object. (Herdado de Attribute.) |
![]() |
Finalize | Permite que um objeto tentar liberar recursos e executar outras operações de limpeza antes que ele é recuperado pela coleta de lixo. (Herdado de Object.) |
![]() |
GetHashCode | Retorna o código hash para essa instância. (Herdado de Attribute.) |
![]() |
GetType | Obtém o Type da instância atual. (Herdado de Object.) |
![]() |
IsDefaultAttribute | Quando substituÃdo em uma classe derivada, indica se o valor desta instância é o valor padrão para a classe derivada. (Herdado de Attribute.) |
![]() |
Match | Quando substituÃdo em uma classe derivada, retorna um valor que indica se esta instância é igual a um objeto especificado. (Herdado de Attribute.) |
![]() |
MemberwiseClone | Cria uma cópia superficial do atual Object. (Herdado de Object.) |
![]() |
ToString | Retorna um string que representa o objeto atual. (Herdado de Object.) |
Início
Implementações explícitas da interface
Nome | Descrição | |
---|---|---|
![]() ![]() |
_Attribute.GetIDsOfNames | Mapeia um conjunto de nomes para um conjunto correspondente de identificadores de despacho. (Herdado de Attribute.) |
![]() ![]() |
_Attribute.GetTypeInfo | Recupera as informações de tipo para um objeto, que pode ser usado para obter as informações de tipo para uma interface. (Herdado de Attribute.) |
![]() ![]() |
_Attribute.GetTypeInfoCount | Recupera o número de interfaces de informações de tipo que um objeto fornece (0 ou 1). (Herdado de Attribute.) |
![]() ![]() |
_Attribute.Invoke | Fornece acesso a propriedades e métodos expostos por um objeto. (Herdado de Attribute.) |
Início
Comentários
Use o ToolboxBrowsableAttribute para especificar quando um controle é visível na Choose Toolbox Items caixa de diálogo para o WPF Designer for Visual Studio ou o Biblioteca de ativos para Microsoft Blend.
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
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.ComponentModel
Imports System.Windows.Media
Imports System.Windows.Controls
Imports System.Windows
Imports Microsoft.Windows.Design
Imports Microsoft.Windows.Design.Features
Imports Microsoft.Windows.Design.Metadata
' The ProvideMetadata assembly-level attribute indicates to designers
' that this assembly contains a class that provides an attribute table.
<Assembly: ProvideMetadata(GetType(CustomControlLibrary.Design.Metadata))>
Public Class ButtonWithDesignTime
Inherits Button
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.
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
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows;
using Microsoft.Windows.Design;
using Microsoft.Windows.Design.Features;
using Microsoft.Windows.Design.Metadata;
// The ProvideMetadata assembly-level attribute indicates to designers
// that this assembly contains a class that provides an attribute table.
[assembly: ProvideMetadata(typeof(CustomControlLibrary.Design.Metadata))]
namespace CustomControlLibrary.Design
{
public class ButtonWithDesignTime : Button
{
}
// 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();
}
}
}
}
Acesso thread-safe
Quaisquer membros static (Shared no Visual Basic) públicos deste tipo são thread-safe. Não há garantia de que qualquer membro de instância seja thread-safe.
Consulte também
Referência
Namespace Microsoft.Windows.Design