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
90
XamDataGrid automatically add new record to bottom?
posted

In this application, generally the user starts with either a blank slate (for which no grid is present until the 'Add row' button is presssed to add a blank record, which they then fill in), or some amount of data that's either been loaded from a previous session or imported. Before, if you wanted to add 5 new rows, you have to hit the 'Add row' button (which actually alters the VM, not the view) five times.

The functionality I am looking for is that when you tab past the last column of the last record, rather than giving focus to the next UIElement in the view, it instead adds a new blank record at the end of the grid, and sets the first cell to edit mode. This allows a user to very quickly input lots of data by keyboard without having to move the mouse up to the 'add row' button for each new line.

I cannot simply make an event handler for the LostKeyboardFocus event, because there are quite a number of other situations in which that event would fire when unintended. Perhaps I need to handle the tab 'button down' event directly with lots of conditionals? I'm hoping there's a more elegant way.