Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
XamNumericEditor restrict binding update when editing
posted

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?

Parents
  • 1935
    posted

    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.

    XamEditorsApp_PropertyChanged_LostFocus.zip
Reply Children