2

I've a Wpf Datagrid with a collection of entity as ItemsSource; entity type implements IEditableObject interface (BeginEdit, CancelEdit, EndEdit).

I want to prevent the datagrid automatically call methods of IEditableObject interface, because I manage the behavior explicitly calling the "BeginEdit" when I select a row of grid and calling the "CancelEdit" when I leave the row without having confirmed it.

Instead, the datagrid automatically called the "BeginEdit" whenever I select a cell and I would avoid it.

Is possible disable this default behavior?

Luca Petrini
  • 1,695
  • 2
  • 28
  • 53
  • With "IsReadOnly = True" I can not edit the cells of the grid, while I have to do it. What I want is not being called the "BeginEdit" entity whenever I do an edit of a cell, but only when I change the selected row. – Luca Petrini Jul 23 '12 at 13:55
  • Try to handle it via grid.BeginningEdit += (o, e) => { if(!selectedRowBlaBlaBla) e.Cancel = true; }; – Rover Jul 23 '12 at 14:27
  • I have solved by using a dummy variable directly in the base class to skip execution of "BeginEdit", "CancelEdit" and "EndEdit" when necessary. – Luca Petrini Jul 26 '12 at 12:41

0 Answers0