| Working with RichTextBox for WPF and Silverlight > Custom Command Bars > Alignment Functions |
The following code snippets demonstrate the code used for aligning text:
Align Left
| C# |
Copy Code
|
|---|---|
rtb.Selection.TextAlignment = C1TextAlignment.Left; |
|
Align Center
| C# |
Copy Code
|
|---|---|
rtb.Selection.TextAlignment = C1TextAlignment.Center; |
|
Align Right
| C# |
Copy Code
|
|---|---|
rtb.Selection.TextAlignment = C1TextAlignment.Right; |
|
Justify
| C# |
Copy Code
|
|---|---|
rtb.Selection.TextAlignment = C1TextAlignment.Justify; |
|