So I have essentially a TextBox where the user inputs data, but if the user doesn't know what to type I want to create a hint, the hint text color will be gray and the input text color will be black.
I've been experimenting with RichTextBoxes, and adding Runs to them, but it seems like the user can delete the Runs. So this approach isn't really working out.
preguntado el 08 de noviembre de 11 a las 15:11
Eche un vistazo a este proyecto: http://www.codeproject.com/KB/WPF/richtextboxintellisense.aspx
You should not add the hint to the TextBox but to an overlayed control.
An Idea :
How if you make a control with a textbox of transparent bg, in a panel. Then add a textblock below textbox (in z-order). Now you can calculate the position of caret in textbox and display hint (text) in textblock accordingly.
Here in image, you can get that caret is at 4th character, so you can display BOX in textblock by using spaces or adjusting LEFT margin with respect to TEXT in textbox size.