ToolboxBrowsableAttribute Constructor
Initializes a new instance of the ToolboxBrowsableAttribute class.
Namespace: Microsoft.Windows.Design
Assembly: Microsoft.Windows.Design (in Microsoft.Windows.Design.dll)
Syntax
'Declaration
Public Sub New ( _
browsable As Boolean _
)
'Usage
Dim browsable As Boolean
Dim instance As New ToolboxBrowsableAttribute(browsable)
public ToolboxBrowsableAttribute(
bool browsable
)
public:
ToolboxBrowsableAttribute(
bool browsable
)
public function ToolboxBrowsableAttribute(
browsable : boolean
)
Parameters
browsable
Type: System.Booleantrue 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 IRegisterMetadata. If found, designers instantiate
' this class and call its Register() method automatically.
Friend Class Metadata
Implements IRegisterMetadata
' Called by the designer to register any design-time metadata.
Public Sub Register() Implements IRegisterMetadata.Register
Dim builder As New AttributeTableBuilder()
builder.AddCustomAttributes( _
GetType(ButtonWithDesignTime), _
New ToolboxBrowsableAttribute(True))
MetadataStore.AddAttributeTable(builder.CreateTable())
End Sub
End Class
// Container for any general design-time metadata to initialize.
// Designers look for a type in the design-time assembly that
// implements IRegisterMetadata. If found, designers instantiate
// this class and call its Register() method automatically.
internal class Metadata : IRegisterMetadata
{
// Called by the designer to register any design-time metadata.
public void Register()
{
AttributeTableBuilder builder = new AttributeTableBuilder();
builder.AddCustomAttributes(
typeof(ButtonWithDesignTime),
new ToolboxBrowsableAttribute(true));
MetadataStore.AddAttributeTable(builder.CreateTable());
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
ToolboxBrowsableAttribute Class
ToolboxBrowsableAttribute Members
Microsoft.Windows.Design Namespace