Поделиться через


ToolboxBrowsableAttribute - конструктор

Инициализирует новый экземпляр класса ToolboxBrowsableAttribute.

Пространство имен:  Microsoft.Windows.Design
Сборка:  Microsoft.Windows.Design.Interaction (в Microsoft.Windows.Design.Interaction.dll)

Синтаксис

'Декларация
Public Sub New ( _
    browsable As Boolean _
)
public ToolboxBrowsableAttribute(
    bool browsable
)
public:
ToolboxBrowsableAttribute(
    bool browsable
)
new : 
        browsable:bool -> ToolboxBrowsableAttribute
public function ToolboxBrowsableAttribute(
    browsable : boolean
)

Параметры

  • browsable
    Тип: System.Boolean
    Значение true, чтобы разрешить видимость элемента управления в обозревателе панели элементов конструктора; в противном случае — значение false.

Примеры

В следующем примере кода показано, как использовать ToolboxBrowsableAttribute, чтобы разрешить видимость пользовательского элемента в обозревателе панели элементов конструктора.

' 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();
        }
    }
}

Безопасность платформы .NET Framework

См. также

Ссылки

ToolboxBrowsableAttribute Класс

Microsoft.Windows.Design - пространство имен

AttributeTableBuilder

Другие ресурсы

Пошаговое руководство. Создание графического элемента времени разработки