Auto-edit row in a Silverlight DataGrid
Is it possible for the DataGrid to automatically enter edit mode when the us开发者_JAVA百科er starts typing on the keyboard, without having to hit F2 or double-click with the mouse first?
I've tried those 2 solutions:
Define only a CellEditingTemplate (no CellTemplate) : doesn't work. the datagrid always displays a textbox but the user still has to double-click or press F2 to enter edit mode
Handle KeyDown event and call BeginEdit:
private void DataGrid_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
(sender as DataGrid).BeginEdit();
}
This works, but I lose the first key the user has pressed. I could work around this problem but I'm looking/hoping for a better solution.
Thank you!
精彩评论