ToolboxBrowsableAttribute Class
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

ToolboxBrowsableAttribute Class

Specifies whether a control is visible in a designer's toolbox browser.

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

public sealed class ToolboxBrowsableAttribute : Attribute

Use the ToolboxBrowsableAttribute to specify when a control is visible in the Choose Toolbox Items dialog box for the Windows Presentation Foundation (WPF) Designer for Visual Studio or the Asset Library for Microsoft Blend.

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

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;

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

                new ToolboxBrowsableAttribute(true));



Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft