Hello,
I'm not sure if this is a bug or if it is intended to happen like this, but for some reason, if I try to add text to a RadRichTextBox after a window has finished loading, the rich text box behaves in an unexpected manner: it adds an extra span and it hides the text by default. It shows the text only after the text box is focused. This doesn't happen though if text is added to the rich text box before the window finished loading. You can easily see this by yourself.
So, on a new project, just add a rad rich text box and in the code-behind add:
you will see that the text box behaves completely different, and it is also prone to throwing different application errors in different circumstances.
I'm not sure if this is a bug or if it is intended to happen like this, but for some reason, if I try to add text to a RadRichTextBox after a window has finished loading, the rich text box behaves in an unexpected manner: it adds an extra span and it hides the text by default. It shows the text only after the text box is focused. This doesn't happen though if text is added to the rich text box before the window finished loading. You can easily see this by yourself.
So, on a new project, just add a rad rich text box and in the code-behind add:
public MainWindow() { InitializeComponent(); var section = new Section(); var paragraph = new Paragraph(); var span = new Span("Span declared in code-behind"); paragraph.Inlines.Add(span); section.Blocks.Add(paragraph); radRichTextBox.Document.Sections.Add(section); } That will work fine, but if you do this:
public MainWindow() { InitializeComponent(); Loaded += MainWindow_Loaded; } private void MainWindow_Loaded(object sender, RoutedEventArgs e) { var section = new Section(); var paragraph = new Paragraph(); var span = new Span("Span declared in code-behind"); paragraph.Inlines.Add(span); section.Blocks.Add(paragraph); radRichTextBox.Document.Sections.Add(section); }
you will see that the text box behaves completely different, and it is also prone to throwing different application errors in different circumstances.