I have a behavior that changes cells in a column to edit mode when it becomes active.
If I am using the mouse to drag a selection of cells, as soon as I enter a cell that changes to edit mode, all the selection is lost.
Is there a way to maintain selection of all cells (including the cell that just changed to edit mode) when a cell changes to edit mode?
Hi rbccm,
Yes it is possible to maintain selection while a cell is in edit mode. However, you have to manually reselect the cell after edit mode as started. The expected behavior of the grid is that when edit mode is started, selection is cleared. You can change this by handling the EditModeStarting event on the XamDataGrid and resetting the Cell.IsSelected property on the previously selected cells. This will mean that you need to keep track of what cells were selected. Take a look at my attached sample. When you hold down the Ctrl key, it will allow you to drag select cells. You'll see that the currently activated cell enters edit mode, but the cell selection has not been lost.
This works for that use case, but does not handle the following use case:
Using the mouse to drag and select multiple cells, and having the cell change to edit mode when it activates.
When the cell EditStarting is called in that use case, none of the cells in the column with the cell going into edit mode are shown as selected.