Implements Right-to-Left (RTL) layout support in WPF using FlowDirection. Use when building applications for Arabic, Hebrew, Persian, or other RTL languages.
View on GitHubchristian289/dotnet-with-claudecode
wpf-dev-pack
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/christian289/dotnet-with-claudecode/blob/main/wpf-dev-pack/skills/implementing-wpf-rtl-support/SKILL.md -a claude-code --skill implementing-wpf-rtl-supportInstallation paths:
.claude/skills/implementing-wpf-rtl-support/# 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
? FlowDirection.RightToLeft
: FlowDirection.LeftToRight;
}
}
```
### 3.2 Language Switching
```csharp
public void SwitchLanguage(string cultureName)
{
var culture = new CultureInfo(cultureName);
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
// Update FlowDirection
Application.Current.MainWindow.FlowDirection =
culture.TextInfo.IsRightToLeft
? FlowDirection.RightToLeft
: FlowDire