React on RichTextBox changes
-
I have a RichTextBox containing a FlowDocument. Now I want to change the formatting of the currently focused inline when the text is changed. Unfortunately, the Span element does not have a TextChanged-event or something like that. So I have to use the RichTextBox' TextChanged-event. But how to access the selected element (Span, Paragraph, ....)?
-
I have a RichTextBox containing a FlowDocument. Now I want to change the formatting of the currently focused inline when the text is changed. Unfortunately, the Span element does not have a TextChanged-event or something like that. So I have to use the RichTextBox' TextChanged-event. But how to access the selected element (Span, Paragraph, ....)?
You can get it using this:
Run spans = XAMLRichBox.Selection.Start.Parent as Run;
Deja View - the feeling that you've seen this post before.
modified on Tuesday, April 29, 2008 4:33 PM
-
You can get it using this:
Run spans = XAMLRichBox.Selection.Start.Parent as Run;
Deja View - the feeling that you've seen this post before.
modified on Tuesday, April 29, 2008 4:33 PM
Thx, works so far. But there's another problem: In XAML, I add a Paragraph to the FlowDocument. At runtime, I dynamically add some spans containing runs to the RTB. If I change the text, it seems like there is a new Run being created right in the Paragraph instead of the Span. Why doesn't he modify the existing Run? :confused: