# Selection.ChangeDirection Method

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

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 20.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > Selection.ChangeDirection Method
- **739 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/changedirection-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/changedirection-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/changedirection-method/llms-full.txt

---

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

```csharp
public bool ChangeDirection(Direction direction);
```

```vbnet
Public Function ChangeDirection(direction As Direction) As Boolean
```

### Parameters

| Parameter | Description |
|---|---|
| direction | Specifies the writing direction. It can be one of the [Direction](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/direction/enumeration/llms-full.txt) values:  \| Value \| Meaning \| \| LeftToRight \| The 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. \| \| RightToLeft \| The 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`.

```csharp
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.");
}
```

```vbnet
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
textControl.Select(0, 17)
Dim selection As Selection = textControl.Selection

If selection.ChangeDirection(Direction.LeftToRight) Then
    Console.WriteLine("Change Direction completed successfully.")
End If
```

---

## Nearby

- **Previous:** [Selection.ChangeCapitalization Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/changecapitalization-method/llms-full.txt)
- **Next:** [Selection.CharacterScaling Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/characterscaling-property/llms-full.txt)
