Thursday, May 27, 2010 8:13 AM
I have this exception when using my application. I know more or less where it comes from :
My application uses tabs. I open a tab containing a datagrid. When i double click on a cell, it automatically creates a new object (in the collection binded). However, lets say my cell is still in editing mode. If i open a new tab, and then want to go back in the previous one, I get this error message.
To avoid this problem, I would like my cell to stop editing mode anytime i click somewhere else.
Thanks by advance for your help.
Thursday, May 27, 2010 12:33 PMAny idea / solution ?
Monday, May 31, 2010 9:05 AMModerator
What is the error message, could you share it? Is it "'DeferRefresh' is not allowed during an AddNew or EditItem transaction"? And it seems a issue of WPF Toolkit DataGrid, Please refer to this link: http://wpf.codeplex.com/WorkItem/View.aspx?WorkItemId=7830 So could you please try to use the latest version of WPF Toolkit or try to code it in the Visua lStudio 2010 with .Net 4(WPF 4 has a DataGrid control)
However, it is hard to find the cause without any code, could you please share some code about your application?
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Monday, May 31, 2010 3:26 PM
For your information, I fully documented a similar case in
When you click on " Bug 551128 : Details/Expand", you can download a documented zip file with all material I could produce for the defer Refresh exception.
If this case matches yours, you can add a vote for 551128 and 532494 (top left)
If your scenario is (even slightly) different, feel free to add your own zip file to 551128 or to open your own DeferRefresh bug entry. This can always help the development/maintenance teams.
Kind regards, Chris.
Wednesday, September 22, 2010 7:12 AM
Hi, I built a workaround for this, which is documented in thread
It basically gets the datagrid out of edit mode (canceling the pending changes) when it loses focus or changes its DataContext. I don't report the whole solution also in this thread, because it is a bit long, so please visit that link.
Friday, October 08, 2010 12:28 PM
documents the limit of the proposed workaround : the model class must implement 'IEditableObject'
- Edited by Rhodos Saturday, October 09, 2010 8:59 AM updating answer completeness
Tuesday, June 07, 2011 2:05 PM
I have the same problem. WPF, Tabs, using IEditableObject but I'm not using DataGrids.
Can I safely catch and ignore this exception or will that open up a can of worms?
Wednesday, June 08, 2011 1:10 PM
If at all possible, you could upload a file attachment with your (simplified) Solution/Project in
https://connect.microsoft.com/VisualStudio/feedback/details/532494/wpf-datagrid-and-tabcontrol-deferrefresh-exception#details (or open an additional connect report)
Your case is quite interesting since you are declaring IEditableObject on your class, a feature that precisely should help avoiding the problem, not cause it.
Tuesday, November 08, 2011 12:25 PM
Try following sequence before calling Refersh on CollectionView or <DataGrid>.Items
Worked for me.
Thursday, October 18, 2012 4:31 AMThanks for Me 2