Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
Cell losing Focus after Cancel Edit
posted

After canceling end edit mode in a xamdatagrid the cell that is in edit mode stays in edit mode, but loses focus and the user must click the cell again.

Is this the default behavior?

Is it possible for the cell to maintain focus and have the text in the cell selected?

 

Parents
No Data
Reply
  • 1945
    posted

    I have a similar issue when cancelling edit mode. Below is a sample code:

    private void XamDataGrid_EditModeEnding(object sender, Infragistics.Windows.DataPresenter.Events.EditModeEndingEventArgs e)

    {

                    if(hasError)

                    {

                                   MessageBox.Show("An error occured...", "Error occured", MessageBoxButton.OK, MessageBoxImage.Error);

                                   e.Cancel = true;

                                   grid.ActiveCell = e.Cell;

                                   grid.ExecuteCommand(DataPresenterCommands.StartEditMode);

                    }

    }

    When cell loses focus by selecting another row with the above code, the cell regains focus and enters edit mode. However if i select another control in which the grid loses focus the above code doesnt' work properly, the cell doesn't regain focus. How should i fix this?

Children