There exists no samples or anything to accomplish this. I have contacted people at msdn, and Microsoft, without any success. I am trying to build a sample but so far no success.
Edit
So what I did to solve this issue: first the problem graphically
In words dragging an element from listbox to a Canvas. SO what I did I added handlers to the listbox like this, in the view:
MyLB.AddHandler(UIElement.ManipulationStartedEvent, new EventHandler<ManipulationStartedEventArgs>(MyLB_ManiStarted), true);
MyLB.AddHandler(UIElement.ManipulationDeltaEvent, new EventHandler<ManipulationDeltaEventArgs>(MyLB_ManiDelta), true);
MyLB.AddHandler(UIElement.ManipulationCompletedEvent, new EventHandler<ManipulationCompletedEventArgs>(MyLB_ManiCompleted), true);
Furthermore I add an extra canvas, here after referred to as Canvas2, that stretches behind the ListBox and Canvas.
The only difference between the two canvas' are the size, else they have the same itemscontrol but with different observablecollections binded to the canvas'.
- In ManipulationStarted I find the element and add a new one to the observablecollection of Canvas2. Furthermore I Set the zindex of Canvas2 to be infront.
- I then tap into the delta event to move the element around on Canvas2
- in ManipulationCompleted I check if the element is inside the bounds of the first Canvas.
- I then delete it from Canvas2, and move Canvas2 to the back, using
Canvas.SetIndex(UIElement, zIndex)
- Depending on the bounds check in (3.) I then add it to the first canvas. And everything works.
But I do not use the drop feature or the related events since it did not seem to help because of the missing dragable element. But this works :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…