How to: Set Margins for a Control in the WPF Designer

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Margins represent the amount of fixed space between the edge of a control and the edge of a window. You can easily set or release margins for a control in the WPF Designer for Visual Studio. 

To set or release margins on the design surface

  1. Drag a control to its desired location on a window. Note that on each side of the control there are either lines or stubs. The lines stretch from the edge of the control to the corresponding edge of the container.

  2. To set a margin, move over a stub until the pointer changes to a pointing finger.

  3. Click the stub. The stub expands to form a margin line and the margin is set.

  4. To release a margin, move over a line until the pointer changes to a pointing finger.

  5. Click the margin line. The line contracts to a stub and the margin for that side is released.

To set margins in the Properties window

  1. Select or add a control on the window.

  2. In the Properties window, find the Margin property.

  3. In the right column, click the drop-down arrow to display the margin editor. The following illustration shows the margin editor.

  4. Use the visual aids provided by the margin editor to set the desired margins.

See Also

Tasks

How to: Set Margins of Elements and Controls

Concepts

Alignment in the WPF Designer