none
Scrolling a ListBox RRS feed

  • Question

  • Is there any examples on how to use swipe gestures with the Kinect SDK to pan through a list of items in a ListBox?  They discussed UI concepts in the live stream today, but was wondering if there is examples on how to do in code. 

    Thanks.

    Thursday, June 16, 2011 7:28 PM

Answers

  • Hi,

    There is no specific example but it something that is easy enougth to put into practice. Within WPF you navigate up and down in a listbox by setting the SelectedIndex property.

    To control this using a gesture we would capture the event raised by the Skeleton API and detect the position of the hand. If the hand has move upwards since the last event, then we decrement the index, if the hand moves down we increment the index. You may need to apply a tolerance on this depending how big/small you want your hand gestures to be.

    This then provides the illusion you are scrolling through the list box based on your hand gestures.

    If you still can't work this out, let me know and I'll try and put a code sample together for you.

    Thanks,
    Lewis


    Follow Me on Twitter: @LewisBenge Or check out my blog: http://www.geekswithblogs.com/pointtoshare/
    Friday, June 17, 2011 1:20 AM

All replies

  • Hi,

    There is no specific example but it something that is easy enougth to put into practice. Within WPF you navigate up and down in a listbox by setting the SelectedIndex property.

    To control this using a gesture we would capture the event raised by the Skeleton API and detect the position of the hand. If the hand has move upwards since the last event, then we decrement the index, if the hand moves down we increment the index. You may need to apply a tolerance on this depending how big/small you want your hand gestures to be.

    This then provides the illusion you are scrolling through the list box based on your hand gestures.

    If you still can't work this out, let me know and I'll try and put a code sample together for you.

    Thanks,
    Lewis


    Follow Me on Twitter: @LewisBenge Or check out my blog: http://www.geekswithblogs.com/pointtoshare/
    Friday, June 17, 2011 1:20 AM
  • Hi Lewis,

    Can you please put up the code sample for this? Would really help :)

    Thanks!

    Friday, June 24, 2011 11:34 PM
  • Yes, It would be great if you can put up some sample here.

    Thanks.


    Nothing Remains Constant... But "CHANGE".....
    Monday, July 18, 2011 3:46 PM
  • Getting the up and down gestures is the hard part, but the actual change to SelectedIndex is trivial:
    Down:
    listBox1.SelectedIndex++;
    
    Up:
    listBox1.SelectedIndex--;
    
    Furthermore, you could also make it so if they go past the end of the list, it brings them to the top, like this:
    try
    {
      listBox1.SelectedIndex++;
    }
    catch (ArgumentOutOfRangeException)
    {
      //go to the top of the list
      listBox1.SelectedIndex = 0;
    }
    
    Wednesday, July 20, 2011 4:56 AM