ToolboxBrowsableAttribute Constructor

Initializes a new instance of the ToolboxBrowsableAttribute class.

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

Syntax

'Declaration
Public Sub New ( _
    browsable As Boolean _
)
public ToolboxBrowsableAttribute(
    bool browsable
)
public:
ToolboxBrowsableAttribute(
    bool browsable
)
new : 
        browsable:bool -> ToolboxBrowsableAttribute
public function ToolboxBrowsableAttribute(
    browsable : boolean
)

Parameters

  • browsable
    Type: System.Boolean
    true to enable visibility for a control in a toolbox browser; otherwise, false.

Examples

The following code example shows how to use the ToolboxBrowsableAttribute to enable visibility for a custom control in a designer's toolbox browser.

' 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 Security

See Also

Reference

ToolboxBrowsableAttribute Class

Microsoft.Windows.Design Namespace

AttributeTableBuilder

Other Resources

Walkthrough: Creating a Design-time Adorner