Get into editing mode by using the keyboard and the DataGridColumnTemplate

Dec 2, 2008 at 8:20 AM
Hi,

How do I get a DataGridColumnTemplate to get into edit mode - by using the keyboard and not the key F2 ?
For example: I create a template that contains the DatePicker. The keys I want to catch is the numbers 0-9 and F2, but I cannot find a location to do this.
Also tried to create a subclass och the DataGridColumn to try this out, but the method OnInput is internal inside the toolkit and I don´t want to place my class inside the local toolkit.

Seached on the discusions and found a suggestion that the event PreparingCellForEdit should be used, however I cannot use this event since the key-event should place the column in editing mode and then the PreparingCellForEdit is raised.

Any suggestions how to do this ?

Bonus question: Is there any plan for including a DataGridColumnDatePicker inside the toolkit or framework 4.0 ?

best regards
/Tony
Coordinator
Dec 3, 2008 at 6:00 PM
One way to do this is to listen to DataGridCell.PreviewKeyDown event and for your DataGridTemplateColumn you can implement something similar to what DataGridTextColumn.OnInput does.  Hope that helps.