I want to let the user to reArrange the displayed records
by making drag and drop between records could any one tell me the first steps to do that
I don't think I get it. You think it's an acceptable option to be forced to use the right button to drag&drop records?
PreviewMouseMove works on the DataGrid, but it won't on DataRecordPresenter. As soon as the mouse left button is clicked, we do not receive the MouseMove event anymore..
It is going to fire (PreviewMouseMove), but you would have to use PreviewMouseLeftButtonDown/Up event also, because it is being handled with selection of the record/cell.
Originally, I used Right Click just for this reason - not to interfere with the Record selection of the grid.
Thank you for the sample, but in my opinion the key disadvantage of it is using of right mouse button. I've tried (both in my project and in the sample you provided) to use left button, but neither PreviewMouseMove, nor MouseMove don't seem while LeftButton is pressed, only selection occurs.
Is there any solution to that?
Hello Stef,
Good one, thanks for the feedback. Actually, if you scrolled down without releasing the button, the dropped record is not the same as the dragged. This is easily solved by setting the Virtualization mode to :
RecordContainerGenerationMode="LazyLoad" .
The problem is that when the dragged record is out of scope it is destoyed and replaced by another one.
With Lazy Load the out of scope records are not destroyed. The problem with the Visual preview still remains.
A workaround for that is saving the visual to something that is not dependant on reference ( hidden image,file etc.).
Alex.
Hello,
great example and works really well except one problem. Using the scroll wheel to scroll up or down the grid changes the displayed record. Its probably only a byref problem. Its easy to reproduce. You just pick up the first record and start scrolling down using the scrollwheel without releasing the record. The "Adorner (preview?") record will change for some reason.
It would be great if you could tell me how to fix this problem
Thanks
Stef