Create a TextBlock

This exercise describes how to add a TextBlock:

  1. Click and drag a TextBlock from the Toolbox to the Design Sheet:
  2. In the Properties pane, enter (or cut and paste) the Text you want to display:
  3. In the Properties pane, scroll down and set the TextWrapping property to Wrap:
  4. Resize the TextBlock to accommodate the text and align the control with other controls on the form.
  5. Resize

    Click and drag the corners of the control to resize the control.

    Reposition

    Click and drag the handle (top-left) to reposition the control.

    VerticalAlignment and HorizontalAlignment properties can be set to align controls to the Top, Bottom, Left, Right, or Centre of the form:

  6. When you give focus to the TextBlock you can edit the text and set the font characteristics of the text you have selected in the block:
  7. To create a new line while editing the text, press SHIFT + Enter. Pressing Enter itself commits your changes and stops editing. Note: Changes will be lost if you click outside of the control.

    A TextAlignment property (and Padding) can be set in the Properties pane to align the text to the Left, Right or Centre of the control.

  8. Save your changes and click Run to run the form:
  9. The form shows the text you have added in the TextBlock: