This project has moved and is read-only. For the latest updates, please go here.

Basic RichTextBox usage - .Text Property does not update

Sep 17, 2012 at 11:34 AM

Hello fine people

I feel a little stupid, but i cannot get the RichTextBox to work at all.

For testing purposes I have a single UserControl with a RichTextBox. I can set text with the .Text property and the TextChanged Event is fired as soon as i type. I can see the changes in the EventArgs (ie. where the character was input etc).

However the .Text property always keeps the initial value. I have not found other means to get the readout. 

This holds true for both the RTF and PlainTextFormatter

I am not using databinding in my Project, so i need to read the content of the Control propgramatically and have no means to set up an impromtu databinding test scenario.

I am completely stumped and desperate for help!

Sep 17, 2012 at 1:53 PM

An issue based on this discussion has been created:

Sep 17, 2012 at 8:02 PM

Okay i do not understand how i can use this Control for my purposes at all.

I need to generate the Control dynamically at run-time. To get any functionality at all i had to wrap it in a UserControl.

Now I can choose between either getting the initial text (ie. Saved Value) to display or to read the changed value after editing.

The initial text (set by .Text in the Loaded event) flashes, then disappears, .Text is empty at that point.

setting .Text to anything after that point works as expected.

What's crazy: Displaying a simple MessageBox at any time during the initialization resolves the problem and the text is then correctly initialized and saved after editing.

I am in despair and will give up on this control for now.

Sep 18, 2012 at 1:14 AM

A new release will be done Tuesday (tomorrow!) . Obviously, this fix won't be able to make it.

Since it seems quite simple to fix, it will very probably be fixed for the October release. Sorry for the inconvenience.

You can also get priority support with the Plus edition:

Oct 9, 2012 at 1:47 PM

Will be fixed in v1.8.

Nov 7, 2012 at 7:44 PM

Fixed in v1.8

Nov 11, 2014 at 6:13 AM
Edited Nov 11, 2014 at 6:13 AM
I also had the same problem,and It seems that the nestest version doesn't work.Finally I soved this problem by this way:

this.SetValue(Xceed.Wpf.Toolkit.RichTextBox.TextProperty, TextFormatter.GetText(this.Document));
this.RaiseEvent(new System.Windows.RoutedEventArgs(System.Windows.UIElement.LostFocusEvent, this));
Nov 11, 2014 at 1:40 PM

v2.3 doesn't seem to have a problem with the RichTextBox.Text property. If you still have a problem in this version, please use a code snippet so we could test the same code.
Thanks !
Nov 20, 2014 at 6:03 AM
    <xctk:RichTextBox x:Name="_richTextBox" Text="{Binding Path=Content,Mode=TwoWay}" Width="200"/>
    <Button Content="Click Me" Click="Button_Click" />
public partial class MainWindow : Window
    private Book book;
    public MainWindow()
        book = new Book();
        this.DataContext = book;

    private void Button_Click(object sender, RoutedEventArgs e)
        _richTextBox.Document.Blocks.Add(new Paragraph(new Run("english")));//statement 1

        System.Diagnostics.Debug.WriteLine("Text is now : " + _richTextBox.Text);

public class Book: INotifyPropertyChanged {
    private string content;
    public string Content {
            return content;
            content = value;

    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

    protected void OnPropertyChanged(string propertyName)
        if (PropertyChanged != null)
                new System.ComponentModel.PropertyChangedEventArgs(propertyName));
When we input some text from the interface,the book.Content gets changed immediately.While if we modify the Document from the code behind(statement 1),the Content doesn't change.If I put some code,like I have mentioned before, behind the statement 1 :

_richTextBox.SetValue(Xceed.Wpf.Toolkit.RichTextBox.TextProperty, _richTextBox.TextFormatter.GetText(_richTextBox.Document));
_richTextBox.RaiseEvent(new System.Windows.RoutedEventArgs(System.Windows.UIElement.LostFocusEvent, _richTextBox));

It is ok now.

Sincerely Yours.