您好我使用devexpress
。
我有一个gridview,当我按下enter键然后按下gridview单元格的单元格时,我想这样做。我希望我能解释一下。谢谢
答案 0 :(得分:0)
引发ProcessGridKey
GridControl事件:
private void dgv_ProcessGridKey(object sender, System.Windows.Forms.KeyEventArgs e)
{
GridControl grid = sender as GridControl;
KeyPress(grid.MainView, e);
}
private void KeyPress(BaseView sender, KeyEventArgs e)
{
var view = (GridView)sender;
if (e.KeyData == Keys.Enter)
{
e.Handled = true;
dgv.BeginInvoke(new Action(() =>
{
view.CloseEditor();
view.MoveNext();
}), null);
}
}
答案 1 :(得分:0)
好吧,对于wpf gridcontrol 14.1和15.1,请使用GridControl_KeyDown / KeyUp事件:
private void AnalyseResultGridControl_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
e.Handled = true;
AnalyseResultGridControl.View.CloseEditor();
AnalyseResultGridControl.View.MoveNextRow();
}
}