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

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 Windows Presentation Foundation (WPF) Designer for Visual Studio. 

To set or release margins for a WPF control

  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.

See Also

Concepts

Alignment in the WPF Designer