RichTextBox for WPF | ComponentOne
C1RichTextBox Task-Based Help / Connecting a C1RichTextBoxToolbar to a C1RichTextBox
In This Topic
    Connecting a C1RichTextBoxToolbar to a C1RichTextBox
    In This Topic

    To connect a C1RichTextBoxToolbar control to a C1RichTextBox control you would need to set the C1RichTextBoxToolbar.RichTextBox property to the name of the control you want to link with the toolbar. You can connect a C1RichTextBoxToolbar control to a C1RichTextBox control at design time, in XAML, and in code.

    At Design Time

    To set the C1RichTextBoxToolbar.RichTextBox property in Microsoft Expression Blend, complete the following steps:

    1. Click the C1RichTextBox control once to select it.
    2. Navigate to the Properties window, and click the Advanced Options button next to the C1RichTextBoxToolbar.RichTextBox property.
    3. In the Create Data Binding dialog box, click the Element Property tab.
    4. In the Element Property tab, select the C1RichTextBox1 item and click OK.

    This will set the C1RichTextBoxToolbar.RichTextBox property to C1RichTextBox1.

    In XAML

    For example, to set the C1RichTextBoxToolbar.RichTextBox property addRichTextBox="{Binding ElementName=C1RichTextBox1}" to the <c1rtb:C1RichTextBox> tag so that it appears similar to the following:

    <c1rtb:C1RichTextBox HorizontalAlignment="Left" Margin="10,10,0,0" Name="C1RichTextBox1" VerticalAlignment="Top" c1:C1NagScreen.Nag="True" Height="83" Width="208" RichTextBox="{Binding ElementName=C1RichTextBox1}" />

    In Code

    For example, to set the C1RichTextBoxToolbar.RichTextBox property add the following code to your project:

    Visual Basic
    Copy Code
    Me.C1RichTextBoxToolbar1.RichTextBox = C1RichTextBox1
    
    C#
    Copy Code
    this.c1RichTextBoxToolbar1.RichTextBox = c1RichTextBox1;
    

    What You've Accomplished

    You've linked a C1RichTextBoxToolbar to a C1RichTextBox control. Now when you type text in the C1RichTextBox, for example, change the content appearance, for example, the font. For more information about the C1RichTextBox control, see the Working with C1RichTextBoxToolbar topics.