TX Text Control .NET for WPF

ChangeDirection Method

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

Changes the writing direction of all selected paragraphs. When the direction of a paragraph is changed, this paragraph's alignment is toggled from left to right or from right to left. The alignment of centered and justified paragraphs is not changed. Left and right tabulators are also toggled.

Syntax

public bool ChangeDirection(Direction direction);

Parameters

ParameterDescription
direction

Specifies the writing direction. It can be one of the Direction values:

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

Return Value

The return value is true, if at least one paragraph has been changed. Otherwise is is false.

Examples

The following example formats the heading of a short document by using Selection.ChangeDirection.

textControl.Text = "Quarterly results\nRevenue increased by 12%.";
textControl.Select(0, 17);
Selection selection = textControl.Selection;

if (selection.ChangeDirection(Direction.LeftToRight))
{
    Console.WriteLine("Change Direction completed successfully.");
}