RichTextBox.TextAlignment Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets or sets how the text should be aligned in the RichTextBox.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
<RichTextBox TextAlignment="textAlignmentValue"/>
XAML Values
Property Value
Type: System.Windows.TextAlignmentOne of the TextAlignment enumeration values. The default is Left.
This property returns the current alignment. Setting this property adjusts the contents of the RichTextBox to reflect the specified alignment.
The following example shows how you can right-align the entire contents of the RichTextBox.
<!--Create a RichTextBox and a Button.--> <StackPanel> <RichTextBox x:Name="MyRTB" Height="100" Width="400" /> <Button x:Name="MyButton1" Content="Right-Align" Height="30" Width="100" Click="button_Click" /> </StackPanel>
Show: