MOVING AND SIZING CONTROLS
Moving controls in the WPF Designer is easy. Simply click and drag the control to its new position.
To move a group of controls, select the controls that you want to move. Then click one of the controls and drag to move the whole group.
Note that you can drag controls in and out of container controls such as the Grid or StackPanel. When you drag a control over a new container, the designer draws a box around the container and displays a tooltip that says “Press Alt to place inside container” where container is the name of the container. If the container doesn’t have a name, the tooltip shows the container’s control type in braces as in [Grid]. As the tooltip indicates, if you press Alt and then drop the control, it goes into the new container. If you drop the control without pressing Alt, the control lands above or below the container.
As you drag a control, the designer displays snap lines to show how the control lines up with other controls. It displays lines when the control’s edges align with another control’s edges. For some controls, it displays lines when the control’s text baseline aligns with the text baselines of other controls.
Figure 4-2 shows the designer dragging the lower button. Four red dashed snap lines show that this control’s edges line up with the left and right edges of the upper button, the left edge of the Rectangle control at the bottom, and the upper edge of the Ellipse control to the right.
FIGURE 4-2: Snap lines show how moving ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access