TX Text Control .NET for WPF

Direction Property

Property|Introduced in 20.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Gets or sets the writing direction. A paragraph's writing direction can be either left to right or right to left.

Syntax

public Direction Direction { get; set; }

Members

ValueDescription
LeftToRightThe writing direction is left to right, which means that blocks of text with left to right and right to left characters are ordered from left to right.
RightToLeftThe writing direction is right to left, which means that blocks of text with left to right and right to left characters are ordered from right to left.

Examples

The following example applies paragraph layout to selected report text by using ParagraphFormat.Direction.

textControl.Text = "First item\nSecond item\nThird item";
textControl.Select(0, textControl.Text.Length);
ParagraphFormat paragraphFormat = textControl.Selection.ParagraphFormat;

paragraphFormat.Direction = Direction.LeftToRight;
Console.WriteLine($"Direction used by Paragraph Format: {paragraphFormat.Direction}");

textControl.Selection.ParagraphFormat = paragraphFormat;

Remarks

The property's default value is Direction.LeftToRight.

The property returns its default value, if the text selection contains multiple paragraphs with mixed direction. The Selection.IsCommonValueSelected method can be used to check for mixed attributes.