Kinect For Windows Interactions Gallery – KinectScrollViewer

posted in: Uncategorized | 0

The next control I want to touch on in the Interactions Gallery is the KinectScrollViewer. Now that we’ve learnt about the Regions, and button controls it’s time to see how we handle putting a lot of them on the page. 


Let’s first put the scrollviewer on the page and to make it obvious when we’ve hit it, we’ll set a bright colour for the hover:

<k:KinectScrollViewer HoverBackground="YellowGreen"></k:KinectScrollViewer>


Normally, it looks no different, but when we hover our hand over the screen the scrollviewer turns “YellowGreen”


I can move my hand around the screen etc. If I close my fist, the hand changes to indicate I’m “gripping”


This is all good, but I have to content, so there is no scroll at the moment. Let’s add a bunch of KinectButtons and see what effect this has.

First I’ll add a horizontal scroll bar in the centre of the screen:

            <k:KinectScrollViewer HoverBackground="YellowGreen" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" VerticalAlignment="Center">
                <StackPanel Orientation="Horizontal" Name="buttonContent"></StackPanel>

And then we’ll add 100 KinectTileButtons to the scrollviewer in codebehind (just for the sake of simplicity)

for (var i = 1; i < 100; i++)
    buttonContent.Children.Add(new KinectTileButton {Content = "Button " + i, Margin = new Thickness(0,40,40,40)});

When we run this we see the items as per normal:


The colour change when we hover over the scrollviewer:


The grip indicator turn on when we close our fist


Then we are free to move the items slowly with a closed fist or to move quickly through the list by moving our fist fast and letting the momentum move it for us.

I found the grip and drag a bit odd at first, after being used to hover and hold from my XBox. After the initial difference it’s much easier to get quicker at using it and be scrolling all over the screen like a pro.

So that’s all you have to do to hook up simple controls that work with the interaction stream out of the box.  If you need to do more complicated thing in your own controls and get to properties of the hands etc. you need to access the interaction stream directly.

Technorati Tags: