

The SelectionChange RoutedEvent also captures the text input because, when a character is inserted, the Property change (the same happens with the TextBox.SelectionStart Property). I'd suggest that you override the SelectionChanged event and determine what Brush you want to be in the foreground of the In such a situation where no text is selected I want to not change the color of existing text but only text entered from here on in.

Also, if the caret is in the middle of a line (with no text selected) and the color is changed, the entire word's (every character in either direction up to the next period, comma, semicolor, line feed, space, etc) color is changed. However, if before entering any text the color is changed (a color button is pressed), it doesn't change the color at the caret (any text entered is displayed in default black). This kind of works it changes the color of selected text properly, and changes the color of text entered from here on in if the caret is at the end of the end of the RichTextBox's document. Range.ApplyPropertyValue(TextElement.ForegroundProperty, currentBrush) (TextElement.ForegroundProperty, currentBrush) currentBrush is the Brush set with the color of the color button push (the color that the text is to be set to) and So far, I've written the following function which attempts to update my text color after after pressing any of the previously mentioned color buttons: I want to be able to change the color of either highlighted text if there is any, or of text entered at the current caret position. I'm using a RichTextBox and would like to add a feature that allows the user to change text color on the fly by pressing color buttons located over the RichTextBox.
