Udostępnij za pośrednictwem


How to: Align to Both Text Baselines and Margins

The WPF Designer for Visual Studio displays snaplines to help you align WPF controls. The WPF Designer also displays snaplines to help you align the text baselines of text-based WPF controls. You can use snaplines to align the text baselines of the following WPF controls: Button, CheckBox, ComboBox, GroupBox, Label, ListBox, TextBox, TextBlock, RadioButton, and RichTextBox.

To align edges of controls

  • On a window with at least two controls, drag or resize one of the controls so that the edge is aligned with another control. When the edges are aligned, a snapline appears indicating alignment. When snaplines appear, you will also see a number near the snapline that changes as you drag the control. The number indicates the distance between the edge of the current control and the edge of the other control."

To align text baselines of text-based controls

  • On a window with at least two text-based controls listed earlier in this topic, drag one of the text-based controls so that the text baseline is aligned with the text baseline of another text-based control. When the text baselines are aligned, a snapline appears indicating alignment.

See Also

Tasks

How to: Turn Off Snaplines

Concepts

Alignment in the WPF Designer