Why doesn't the NewValue in the event arguments hold the value in the editor? Isn't it a bit convoluted to have to access the editor for the value?
Hello,
I have been looking into your question and the ‘CellExitingEditMode’ event is raised before a cell has exited edit mode. This is why the value is not still changed. The event that you are looking for is ‘CellExitedEditMode’. It is raised after a Cell has exited edit mode.
If you need any further assistance, feel free to ask.
That's not what I mean. I'm checking in CellExitingEditMode whether the user has actually entered a new value or if the value is same as the original value when entering edit mode.
The event has a NewValue object which sounds like it should be the newly entered value but still holds the old value. If I change the value here, it is later reflected by the binding and the cell. However, if the value remains the same, then the editor value is used. This is a bit confusing. It seems to me that it would make more sense if NewValue held the new value. The old value is still available under Cell.Value.
CellExitedEditMode no longer has the original value and I cannot make the determination.
This is needed because I do not want to make a call to update the DB if there is no actual change in value.
Can you try it with a template column with editor template as text box?
Please attach me an isolated sample application.
Looking forward to hearing from you.
Click the items source button, then enter a value into column C. The messagebox shows the NewValue object.
Thank you for your patience.
I have discussed your concerns with our development teams and for some columns (like TemplateColumn and UnboundColumn) the new value cannot be predetermined because of the use of DataTemplates and user-defined bindings. In our future releases of the product the ‘ExitEditingCellEventArgs.NewValue’ will be null for such cases to avoid confusion.
You can still access the new value through e.Cell.Value if required.
Thanks for the update. Using e.Cell.Value is fine, but I think it would also be good to clarify on the documentation.