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
Hello,
I have attached an example of how to drag and drop records from one grid to another, also from one grid to itself.
I had to delete the images to decrease the volume of the project because of limitations.
Alex
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
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.
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..
This is how I decided to implement this as I did not to interfere with the current functionality and use a different approach. The WPF framework does not support drag&drop directly, but gives you the freedom to handle the Drag, Drop, DragEnter events and their tunneling equivalents, so you can try that as well.
Hi again Alex :)
I have looked at your example of drag and drop functionality and I have converted it to use left mouse button instead of right one. That bit of it works just fine and thank you for leading the way :)
However, something else doesnt seem to work: In my case I have multiple xamgrids each one on different dock manager panel. It appears that once the mouse button is pressed while mouse was over the grid on the dockpanel that dock panel remains "active" even if you move the mouse away from it. so I never get the mouse enter or the mouse move events on any other component in the same application.
Can you share any thoughts on this subject?
Regards,
Kyryll
Hello Kyryll,
I reproduce this issue. I modified my example a little to fix that. The issue is coming from the type of events. They are being handled, because you are using the bubbling type. Try with the PreviewMouseLeftButtonDown and PreviewMouseRightButtonUp and it should work, as it works with me. If you still have problems, I will send you my modified copy of the project.
Alex.
Can't wait till we have better feature parity with the winform ultragrid.
Shrenik,
Thanks for this. The sample looks great. Moreover, you can check out the "official" way of implementing Drag-Drop by handling the built-in events for that. You can find the sample here: http://blogs.infragistics.com/blogs/alex_fidanov/archive/2009/07/28/drag-amp-drop-with-datapresenter-family-controls.aspx
Hi,
Thanks for this sample, Its really good starting point. I found some issue with this sample like:
1. DataRecordPresenter will return null if Field is not editable
2. When we need to drag-drop some times autoscroll also required.
3. LazyLoad is not resolving the issue of disappering Visual.
4. Drop indication...
I have updated your sample. and posting here back for future user benefits.
Attached sample solved all above problem by creating all the fields as editable but not editable :) which can be applied at individual field level.
Regards
Shrenik
Hello Hua,
I believe you meant "can work with left mouse button". I am attaching that sample too (without the images)
Hello Alex,
I got "DragDropXamGrids test.zip" from helpdesk, it works with right mouse button. If your modified copy can work with right mouse button to drag and drop a record in datagrid, please send the copy to me.
Thanks in advance,
Hua