Doing drag drop with HandPointers RRS feed

  • General discussion

  • As first seen on this thread:

    Take a look at

    I've zipped up a DragDropElement implementation and a DragDropSample page.

    You can place those 3 files in ControlsBasics-WPF in the Pages folder. Then add the following to the SampleDataSource -- put it near the KinectPointerPointSample reference in SampleDataSource.cs:

                         new SampleDataItem(
                             "Drag Drop",
                             "Shows how to implement a DragDropElement",

    Would love feedback about this.

    Thanks, Rob

    Rob Relyea [MSFT]

    Rob Relyea [MSFT]

    • Changed type Rob Relyea [MSFT] Friday, September 12, 2014 10:01 PM wasn't a question
    Friday, September 12, 2014 8:07 PM

All replies

  • This is a nice example of how to move a rectangle around a Canvas in Kinect...

    But how can it interact with other objects? In my case ones that have AllowDrop="True"?

    For example: If I put your DragDropElement around an Image then shift it up to a Canvas that is subscribed to the Drop event nothing is fired upon letting go.

    The mouse equivalent of:

    private void ImagePreview_MouseDown(object sender, MouseButtonEventArgs e)
        DragDrop.DoDragDrop((DependencyObject)sender, ((Image)sender).Source, DragDropEffects.Copy);
    private void Canvas_Drop(object sender, DragEventArgs e)
        foreach (var format in e.Data.GetFormats())
            ImageSource imageSource = e.Data.GetData(format) as ImageSource;
            if (imageSource != null)
                // Do something...



    • Edited by Brad Lane Saturday, September 13, 2014 7:07 AM
    Saturday, September 13, 2014 7:07 AM
  • very cool and easy to use, but as Brad says there may be missing some interaction events.

    I had to create some custom Drop events in order to notify my app a Drop occurs with the new coordinates.

    Vincent Guigui Innovative Technologies Expert at OCTO Technology Kinect For Windows MVP award

    Saturday, September 13, 2014 8:06 AM
  • Brad/Vincent-

    Can you describe the structure of your XAML that you want to do this with?

    I've experimented with WPF dragdrop APIs, but DoDragDrop has a mouse dependency built in, which makes it not work well for hand pointer use.

    I'd like to make sure I understand a few scenarios correctly, so I can evolve this sample to meet most needs.

    Thanks, Rob

    Rob Relyea [MSFT]

    Thursday, September 18, 2014 12:16 AM
  • Hi Rob,

    The scenario I was playing with the other day was basically picking up an image, dragging it over a panel then letting it go. Upon letting go I needed to fire an event to pickup if the image was overlapping a panel then apply some changes to said panel.

    So in essence I was trying to setup a literal drag and drop between an image and panels while firing the appropriate events on grab, drag and drop.



    Saturday, September 20, 2014 7:25 AM
  • Hi Rob,

    worked like a charm. Thank you.

    Wednesday, October 1, 2014 11:41 AM
  • Hi

    Any news about the development of this component? I'm also interested in interaction with other components.


    Thursday, February 19, 2015 3:26 PM
  • Sorry, I've not been able to continue to investigate this area. Somebody from the community will have to run with that.


    Rob Relyea [MSFT]

    Monday, February 23, 2015 6:39 PM
  • Thanks for answering, Rob.

    I'm coding some customized components and found your code very useful. Although I think drag and drop is a very common interaction and it should be great if Kinect SDK supported it in a more general way.

    I don't know why DoDragDrop has this mouse dependency. Shouldn't it be dependent of "pointer"? It could be mouse, but also Kinect hand pointer, a finger, a stylus...

    Tuesday, February 24, 2015 10:13 AM
  • Hi,

    I have implemented a scrollviewer which can be scrolled up or down by gestures “Up” or “Down”, the user can drag elements and drop them out of scrollviewer. When a user gestures “Up” or “Down”, I use TranslateTransform and DoubleAnimation to animate the elements in the scrollviewer up or down respectively. 

    When a user drags an element out of scrollviewer I want to keep the original element and drag the copy of it. Unfortunately I am not able to do so because I can’t set IInputModel.Element to the copy of original element as it is read only. In other words I can’t set IKinectController manually to other elements.

    Any solution or workaround will be appriciated. I am using WPF Framework, C# / XAML, Kinect SDK v2, .net 4.5. 

    Thanks & Regards,


    Thursday, June 16, 2016 10:19 AM