DataGridTextColumn keystrokes

Dec 21, 2009 at 2:24 AM

I want to catch the keystrokes for a DataGridTextColumn in my own control derived from DataGridTextColumn. The method I have come up with seems quite convoluted for such a simple task.

In the PrepareCellForEdit I grab the TextBox and add an event handler for the KeyDown event.

In the CommitCellEdit or CancelCellEdit I release the stuff I built in the PrepareCellForEdit event.

Is there a better way to accomplish this. I want to use the MaskedTextProvider while the client is entereing data.

 

Thanks.