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
675
XamDataGrid active data item is being automatically reset.
posted

I'm using XamDataGrid in a MVVM WPF project. I've bound the ActiveDataItem to the CurrentBook property in my ViewModel. Double clicking a record (book) in the XamDataGrid opens another window in which to edit it. The window's data context is the same ViewModel as the XamDataGrid's and the text boxes in the "editor" window are bound to the CurrentBook property. All editing and saving works fine.

I also have several buttons in the editor window that are bound to the "RecordAbove" and "RecordBelow" commands so you can scroll through the list from the editor window. This also works fine with the XamDataGrid's ActiveDataItem automatically updating the viewmodel which in turn automatically updates  the editor window.

Here is my problem. Let's say I double click book number 21 in the XamDataGrid. The editor opens with 21 loaded. Now I scroll to book number 23 using the RecordBelow command several times. Everything looks great at this point. The XamDataGrid has the correct record selected etc. I can even make changes to book 23 and save them. But, when I close the editor window, the ActiveDataItem of the XamDataGrid automatically resets to book number 21 and both 21 and 23 are selected even though I've set SelectionTypeRecord="Single"

What I really want, is to exit the editor window and simply have book 23 as the ActiveDataItem with nothing else selected.

Any Ideas?