Share via

Common WPF Controls

Windows Presentation Foundation (WPF) enables you to create visually enhanced user interfaces for your applications. Even the typical controls you're used to seeing in a standard Windows Forms application are enhanced in WPF applications. The standard WPF controls resemble those you'll find in the Toolbox for Windows Forms. WPF controls are part of the System.Windows.Controls namespace instead of the System.Windows.Forms namespace. WPF controls can also be created by using XAML markup. For more information, see Designing a User Interface for a WPF Application.

When you drag WPF controls from the Toolbox to the design surface, the controls resemble controls in a Windows Form application. However, WPF controls can be customized. Controls in WPF support styles and templates that enable you to create visually compelling applications. To modify the appearance of a control, you add styles and attributes to the control in the XAML editor. Because writing XAML markup manually is difficult, you might want to consider using an application than can generate XAML for you, such as Expression Blend. For more information, see Collaboration with Expression Blend.


To add a control to the WPF window

  1. On the File menu, click New Project.

  2. In the New Project dialog box, in the Templates pane, click WPF Application.

  3. In the Name box, type WPFControls, and then click OK.

  4. A new Windows Presentation Foundation project is created.

  5. From the Toolbox, drag a TextBox control to the upper-right side of the WPF window.

  6. Click the text box.

  7. Set the following properties for the text box in the Properties window.









  8. Add a Button control to the WPF window, next to the text box.

  9. Change the text between the opening and closing Button tags in the XAML Editor from Button to Add, as shown in the following example.

    <Button Height="23" HorizontalAlignment="Right" Margin="0,59,35,0" 
        Name="Button1" VerticalAlignment="Top" 

    The text on the button changes after you type the new value.

  10. Add a ListBox control to the WPF window underneath the text box.

  11. Double-click the button to add the default event handler, and add the following code:

    if (textBox1.Text != "")
        textBox1.Text = "";
  12. Press F5 to run your program. A window that contains the text box, list box, and button that you just added appears.

  13. Type some text in the text box and then click the Add button. Verify that the text was added to the list box.

  14. Add additional text to the list box.

Standard WPF Controls

The following table shows the most common WPF controls, which you can find in the Common tab of the Toolbox.

Control name



Displays a border around content.


Enables a user to perform an action by clicking a button. The Buttonbase.Click event occurs when a Button is clicked.


Enables a user to select and clear a check box to indicate a Yes/No or True/False value.


Enables a user to select an item from a drop-down list. The list is displayed when the user clicks a drop-down arrow.


Defines a flexible grid area that consists of columns and rows.


Displays an image.


Displays text on a form. Provides support for access keys.


Enables a user to select an item from a list.


Enables a user to choose from among mutually exclusive items. The selection of one radio button is mutually exclusive to any other radio button in the same container.


Enables you to stack child controls vertically or horizontally.


Enables visual content to be arranged in a tabular form.


Displays unformatted text and enables users to enter text.

Additional controls available in the Toolbox include the following:

  • Container controls, such as System.Windows.Controls.Canvas, System.Windows.Controls.DockPanel, and System.Windows.Controls.Frame. For more information, see WPF Container Controls Overview.

  • Menus and Toolbars, such as System.Windows.Controls.Menu, System.Windows.Controls.ToolBar, and System.Windows.Controls.Primitives.StatusBar.

  • Document controls, such as System.Windows.Controls.DocumentViewer and System.Windows.Controls.FlowDocumentPageViewer.

See Also


Designing a User Interface for a WPF Application

How to: Create a New WPF Application Project

How to: Create Event Handlers for WPF Controls