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
1233
start edit mode on failed validation
posted

i want to enter edit mode for a failed validation.  I don't understand why I can't get the grid to enter edit mode.  The validation is lighting up correctly and the cell has focus (dotted selection).  But edit mode is failing to start.

 

 

 

 

 

 

 

 

 

 

 

 

public void OnValidationFailed()
        {
            foreach (var currentCell in grdResults.RecordManager.Current.OfType<DataRecord>()
                .Where(record => record != null)
                .SelectMany(record => (from currentCell in record.Cells
                                       let cvp = CellValuePresenter.FromCell(currentCell)
                                       where cvp != null && cvp.HasDataError
                                       select currentCell)))
            {
                currentCell.IsActive = true;
                grdResults.ActiveCell = currentCell;
                grdResults.ExecuteCommand(DataPresenterCommands.StartEditMode);
                return;
            }
        }

Parents
No Data
Reply
  • 138253
    Suggested Answer
    Offline posted

    Hello,

     

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking through your post and I suggest you add the following code in the EditModeEnded event of the XamDataGrid:

    if (e.Cell.HasDataError) { Dispatcher.BeginInvoke(new Action(() => { e.Editor.StartEditMode(); }), DispatcherPriority.Background, null); }

    
    
    

     

    In order to force the Cell to enter edit mode if the value didn’t pass validation.

     

    Feel free to write me if you have further questions.

Children
No Data