开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜