Edit

Share via


TextAlignment Enum

Definition

Specifies whether the text in the object is left-aligned, right-aligned, centered, or justified.

C#
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
public enum TextAlignment
Inheritance
TextAlignment
Attributes

Fields

Name Value Description
Left 0

Default. Text is aligned to the left.

Right 1

Text is aligned to the right.

Center 2

Text is centered.

Justify 3

Text is justified.

Examples

In the following example, the TextAlignment property is set to Left.

XAML
<FlowDocumentReader>
  <FlowDocument
    FontSize="24"
    LineHeight="48"
  >
    <Paragraph TextAlignment="Left" Background="AliceBlue">
      One<LineBreak/>
      two two<LineBreak/>
      Three Three Three<LineBreak/>
      four four four four<LineBreak/>
      Five Five Five Five Five
    </Paragraph>
  </FlowDocument>
</FlowDocumentReader>

Remarks

The enumerated values for the TextAlignment class are Left, Right, Center, and Justify.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9