I am using a XamNumericEditor in a XamDataGrid. I need the editor to update its binding whenever the user hits the up or down arrow buttons. However, when the user is in edit mode I need the user to hit enter in order to update the binding.I can only get the up/down buttons to update the binding if I set DataItemUpdateTrigger="OnCellValueChange". This setting will also update the binding if I change the text in the edit control - which in my case is dangerous.
Is there a way to restrict updating the binding when the edit control is in edit mode?
Hello James,
I have been looking into your scenario and there is no built-in functionality that allows the cell value to be updated on property changed and on lost focus at the same time by either clicking the spin buttons or tying into the editor.
As a starting point, what you could do is to handle the XamDataGrid's CellUpdating event by canceling it when the user is typing. In addition, XamNumericEditor's PreviewKeyDown, PreviewMouseLeftButtonDown and EditModeEnding, EditModeEnded events should be handled. The synchronization between the event handlers could be done by using a private flag member from Boolean type.
Please take a look at the attached sample and let me know if you have any other questions on this matter.
Martin,
Thank you for the sample code - I think this will work.
Please do not hesitate to ask if you have any other questions on this matter.