Hi. I'm trying to do a drag and drop operation with the XamDataGrid. I'm using a hit test and the PreviewMouseLeftButtonDown event to get the object. For the most part, it works. The problem is when the top row isn't the first item, and I drag and drop the first row, it gets the object in the above row instead of the row that was selected.
Here's an example of what I mean:
TARGET SOURCE________ _X_______ <- hidden because it’s already scrolled out of position|A | |Y | <- drag and drop this one|B | |Z ||C |RESULTS________|A | |B | |C | |X | <- it gets X instead of Y
I included a sample to show the bug. The project is built using VS2010.
When running the sample, just drag and drop items from the source to the target grid. The item should get added to the target grid. If you scroll down on the source grid and drag and drop the item in the first row, it adds the wrong data.
I am experiencing quite the same problem.
We have hooked up the MouseDoubleClick event on a XamDataGrid and are doing a HitTest via the mouse position to get the value presenter and the data record. Once we've changed the sort order in the grid (click on column header), the HitTest returns the wrong item when double clicking on the first row (it's always the first row). For all other rows the HitTest works fine.
I have eventually changed the code and are listening now in the CellValuePresenter instead. This works fine - but the bug still exists in the XamDataGrid.
Regards,
Stefan.
HI,
I am just following up on this case.
Please let me know if you need further assistance.
Sincerely, Matt Developer Support Engineer
HI ,
I wired up the DataRecordPresenters PreviewMouseLeftButtonDown, instead of the XamDataGrids event. I am attaching a new sample.