#187 – Adding Controls to a Window Using Visual Studio

In Visual Studio, you can add user interface controls to a window by dragging them onto a design surface.  Start by double-clicking on the window’s .xaml file in the Solution Explorer.

This will open the window in a design view editor.  The editor will have a design surface at the top and a XAML editor below that.

You can add new controls to the window by dragging them onto the design surface in the top pane or by editing the XAML directly.

To drag a control onto the design surface, find the list of WPF controls in the Toolbox window.  Once you find the control that you want, left-click and drag it onto the window’s design surface.  In the example below, we add a CheckBox to the window.

When you’re done dragging, the new control will show up both on the design surface and in the XAML.

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #187 – Adding Controls to a Window Using Visual Studio

  1. Pingback: #286 – Adding Controls to a Window in Visual Studio by Editing XAML « 2,000 Things You Should Know About WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: