Export (0) Print
Expand All
Expand Minimize

TextAlignment Enumeration

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

Namespace: System.Windows
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)] 
public enum TextAlignment
/** @attribute LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) */ 
public enum TextAlignment
LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) 
public enum TextAlignment
<object property="EnumerationValue" .../>

 Member nameDescription
CenterText is centered. 
JustifyText is justified. 
LeftDefault. Text is aligned to the left. 
RightText is aligned to the right. 

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

Example of text alignment values


Text displayed with different alignments

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

<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>

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft