RichTextBox for WPF | ComponentOne
Working with WPF RichTextBox / Custom Command Bars / Alignment Functions
In This Topic
    Alignment Functions
    In This Topic

    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;