implementing-wpf-rtl-supportlisted
Install: claude install-skill christian289/dotnet-with-claudecode
# WPF RTL (Right-to-Left) Support
Implement bidirectional text and mirrored layouts for RTL languages.
## 1. RTL Languages
| Language | Culture Code | Direction |
|----------|-------------|-----------|
| Arabic | ar-SA, ar-EG | RTL |
| Hebrew | he-IL | RTL |
| Persian (Farsi) | fa-IR | RTL |
| Urdu | ur-PK | RTL |
---
## 2. Setting FlowDirection
### 2.1 Window Level
```xml
<!-- Left-to-Right (default) -->
<Window FlowDirection="LeftToRight"
Title="My Application">
<!-- Right-to-Left -->
<Window FlowDirection="RightToLeft"
Title="التطبيق">
```
### 2.2 Element Level
```xml
<Window FlowDirection="RightToLeft">
<StackPanel>
<!-- Inherits RTL from parent -->
<TextBlock Text="مرحبا بالعالم"/>
<!-- Override to LTR for specific content -->
<TextBlock FlowDirection="LeftToRight"
Text="user@example.com"/>
</StackPanel>
</Window>
```
### 2.3 Resource-Based
```xml
<Window FlowDirection="{DynamicResource AppFlowDirection}">
<!-- In ResourceDictionary -->
<FlowDirection x:Key="AppFlowDirection">RightToLeft</FlowDirection>
```
---
## 3. Dynamic FlowDirection
### 3.1 Based on Culture
```csharp
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
SetFlowDirection();
}
private void SetFlowDirection()
{
var culture = Thread.CurrentThread.CurrentUICulture;
FlowDirection = culture.TextInfo.IsRightToLeft
? F