What I am trying to do when the user is in a textbox (in silverlight 2.0):
- When user presses the decimal point (.) on the numeric pad, I want to have it replaced by the correct decimal separator (which is comma (,) in a lot of countries)
I can track that the user typed a decimal point by checking in the keydown event
void Cell_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Decimal)
But how do I replace that key with an other in Silverlight. The e.Key is read only. Is there a way to ‘send an other key’ to the control? Or any other suggestions?
Using Alterlife’s answer as a hint for replacing contents, I have the following working hack… But I don’t like it :-(.
So suggestions for better, more generic, solutions are very welcome!
The hack: