Sunday, September 2, 2012

CellEditEnded happens too late

CellEditEnded happens too late

When the user changes the value of a cell (DataGridCheckBoxColumn) and then clicks on another UI element outside of the datagrid, the click event of the other UI element fires before the datagrid CellEditEnded.

This is a problem because in my case that other UI element is a button that changes Filter property of the PagedCollectionView that is feeding the datagrid (essentially it's simulate a "move to page 2" of rows to edit) The exception that is thrown is:

'Filter' is not allowed during an AddNew or EditItem transaction.

How do I force the finish of the EditItem (or AddNew for that matter) before setting the filter?

Answers & Comments...

Answer: 1

I don't know about silverlight, but in WPF you may try to commit the transaction before setting the filter:

if ((collection as IEditableCollectionView).IsAddingNew) (collection as IEditableCollectionView).CommitNew(); // or .CommitEdit(); 
by : Andreyhttp://stackoverflow.com/users/483408




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog