共用方式為


Choose Toolbox items, WPF components

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

This tab of the Choose Toolbox Items dialog box displays a list of Windows Presentation Foundation (WPF) controls available on your local computer. To display this list, select Choose Toolbox Items from the Tools menu to display the Choose Toolbox Items dialog box, and then select its WPF Components tab. To sort the components listed, select any column heading.

  • When the check box next to a component is selected, an icon for that component will be displayed in the Toolbox.

    Tip

    To add a WPF control to a project document that's open for editing, drag its Toolbox icon onto the Design view surface. Default markup and code for the component are inserted into your project, ready for you to modify. For more information, see Toolbox.

  • When the check box next to a component is cleared, the corresponding icon will be removed from Toolbox.

    Note

    The .NET components installed on your computer remain available whether or not icons for them are displayed in the Toolbox.

The columns on the WPF Components tab contain the following information:

Name

Lists the names of WPF controls for which entries exist in your computer's registry.

Namespace

Displays the hierarchy of the .NET API namespace that defines the structure of the component. Sort on this column to list the available components within each .NET namespace installed on your computer.

Assembly Name

Displays the name of the .NET assembly that includes the namespace for each component. Sort on this column to list the namespaces contained in each .NET assembly installed on your computer.

Directory

Displays the location of the .NET assembly. The default location for all assemblies is the Global Assembly Cache. For further information on the Global Assembly Cache, see Work with assemblies and the Global Assembly Cache.

UIElement List

Filter

Filters the list of WPF controls based on the string you provide in the text box. All matches from any of the four columns are shown.

Clear

Clears the filter string.

Browse

Opens the Open dialog box, which lets you navigate to assemblies which contain WPF controls. Use this to load assemblies which are not located in the Global Assembly Cache.

Language

Shows the localized language of the assembly which contains the selected WPF control.

Limitations

Adding a custom control or UserControl to the Toolbox has the following limitations:

  • Works only for custom controls defined outside the current project.

  • Does not update correctly when you change the solution configuration from Debug to Release, or from Release to Debug. This is because the reference is not a project reference, but is for the assembly on disk instead. If the control is part of the current solution, when you change from Debug to Release, your project continues to reference the Debug version of the control.

In addition, if design-time metadata is applied to the custom control and this metadata specifies that the Microsoft.Windows.Design.ToolboxBrowsableAttribute is set to false, the control does not appear in the Toolbox.

You can reference your controls directly in XAML view by mapping the namespace and assembly for your control.

See also