Udostępnij za pośrednictwem


How to: Use a Third-Party WPF Control in a WPF Application

The Windows Presentation Foundation (WPF) Designer for Visual Studio makes it easy to use third-party controls in your WPF applications. This topic shows how to use a WPF control which is deployed in a separate assembly. 

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To use a third-party WPF control in your application

  1. Open the XAML file for your project's main window in the WPF Designer. For example, you might open Window1.xaml or UserControl1.xaml.

  2. Right-click the Toolbox and select Chose Items from the shortcut menu.

    The Choose Toolbox Items dialog box opens.

  3. Click the WPF Components tab.

  4. In the list, locate the control you wish to use.

  5. If the control you want to use does not appear in the list, click the Browse button. In the Open dialog box, navigate to the assembly which contains the control you want to use. Select the assembly and click Open.

    The control appears in the Choose Toolbox Items dialog box.

  6. Ensure that the check box next to the control is checked, and then click the OK button.

    The selected control appears in the Toolbox.

  7. From the Toolbox, drag the control onto the design surface.

    The selected control appears on the design surface. Also, the control's assembly is added as a project reference, and a namespace mapping is added to the open XAML file.

See Also

Tasks

How to: Import a Namespace into XAML

How to: Add Items to the Toolbox

Concepts

Project References

Reference

WPF Components Tab, Choose Toolbox Items Dialog Box

Other Resources

Working with Controls in the WPF Designer