I'm attempting to extend a RichTextBox in order to add some functionality, and need the ability to call a function when certain characters are entered. For instance, every time a user enters a ';', I want to call that function.
I know that I can add a OnTextChanged(object sender, TextChangedEventArgs e)
method to the TextChanged
event, but that doesn't seem to really solve my problem, since I can't seem to find a good way to tell what the changes were. I could check the whole document for ';' every time the text changes, but that seems to be a bit inefficient to me.
Does anyone have a better solution?