Dynamic font color changes on text input

Apr 16, 2010 at 1:13 AM
Edited Apr 16, 2010 at 11:35 AM

I need to have a textblock type of control that a user can type into. As he types, if I find that he has used a keyword, that keyword should turn red.  For example, suppose he types the following...As soon as he types the word 'red', I would want it to change font color:

                    He saw nothing but red when he got his bill. 

Basically, I need the type of behavior that programmers see in Visual Studio -- dynamic coloring of a word or words as you type-- such as a recognized keyword, i.e. string mysamplestring

Can you point me in the right direction? Do I start with a flowdocument and a converter behind it on each keypress event?  If I find a keyword, do I then add markup to it? Does anyone have a sample of this? I would very much appreciate some direction here!

Thank you.