Devexpress gridview通过输入集中到下一行

时间:2015-07-02 09:04:02

标签: gridview devexpress

您好我使用devexpress

我有一个gridview,当我按下enter键然后按下gridview单元格的单元格时,我想这样做。我希望我能解释一下。谢谢

2 个答案:

答案 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();
            }
        }