0

I use Xceed dll library in my WPF c# application. Sometimes my users get an error when they reach myGrid.EndEdit(). Error is:

An attempt was made to call the EndEdit method of an item that is not part of the specified context.

How do I can get this error in test mode? And how to solve it?

Merta
  • 965
  • 1
  • 11
  • 23

1 Answers1

0

If it's a master-detail (multiple levels) grid then there is a DataGridContext for the top level, but also one for each expanded detail group.

In this case the error may go away by calling EndEdit() on the row rather than the grid.

if (myGrid.GlobalCurrentItem is DataRowView row && myGrid.IsBeingEdited) row.EndEdit();

This could be classed as an Xceed bug as you'd expect your code to work.

Tracking Xceed errors down can involve knowing exactly what order of clicks and presses the user has done. For example, once a user has put a cell into edit mode by clicking on it you can then find you can't update the values programmatically until you've called the EndEdit().

James_UK_DEV
  • 519
  • 1
  • 6
  • 17