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
2320
DragDrop from XamGrid to XamTree
posted

I almost have this working and just need some guidance on whether I'm going about this correctly and more importantly how to fix the tiny issue I am having.

I have uploaded a small sample project with the problem mentioned below.

I want to be able to drag multiple grid rows from the XamGrid to a XamTree.  I don't physically need anything to move or change, I just need it to appear to the user they are dragging something to a specific XamTreeitem.

By crawling the forums I found a couple different approaches to this. Non seemed to be a perfect fit or to work completely but I was able to splice together something that almost works.

Approach

I loaded the tree nodes dynamically in code-behind and call SetDropTarget to specify which nodes are DropTargets.  Working perfectly.

I could not figure out how to get XamGrid row's to be Drag Source objects.  I posted elsewhere about this but know one has replied.

I found an example where they provided a custom DragTemplate at the XamGrid level.  I put a TextBlock in the DataTemplate with Text="" so I basically get what I want.  Just the default drag cursor and not the whole entire grid moving.  This seems to work and I have only one issue with the XamGrid.

After the drag is finished, if I move the mouse back to the XamGrid, it starts selected all rows until I refocus or re-click the grid.  Its like something gets messed up with its Visual State.

Any help would be greatly appreciated.

 

DragAndDrop_Infra82.zip
Parents Reply Children