This is a migrated thread and some comments may be shown as answers.

Prevent row from staying in edit mode?

1 Answer 285 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 25 Apr 2019, 08:23 PM

It is causing a lot of issues for us that the row stays in edit mode if you click out from one cell into another. I would like to disable this but everything I have tried either doesn't work, or the cell flashes up into edit mode before the editor goes away.

 

For example, if I handle the CurrentCellChanged and either commit or cancel the edit, it just goes back into edit mode anyway. I can use BeginInvoke which kind of work but causes some other issues for me down the line.

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 30 Apr 2019, 03:01 PM
Hello Steve,

The easiest approach that comes to mind for achieving the desired functionality would be to handle the PreviewMouseLeftButtonDown event and commit edit, if the RadGridView is currently in edit mode. Here is what I have in mind:
private void gridView_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (this.gridView.Items.IsEditingItem)
            {
                this.gridView.CommitEdit();
                e.Handled = true;
            }
        }

Note, that in the above snippet "this.gridView" refers to the RadGridView instance that you are targeting. 

Can you give this approach a try and let me know, if it helps?

I am looking forward to your reply.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Steve
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or