Click here to Skip to main content
13,903,514 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


16 bookmarked
Posted 24 Dec 2013
Licenced CPOL

Kinect status and setup the Kinect for interaction

Rate this:
Please Sign up or sign in to vote.
Kinect for windows status and setup the Kinect for interaction


The article will give you a getting started with kinect for windows sensor SDK 1.8 and how the kinect for interaction works. I am going to use the kinect sdk 1.8 and a WPF project using visual studio. 


  • Visual studio 2012
  • .NET 4.5
  • Kinect for windows sensor device.
  • Kinect for Windows SDK (
  • Kinect for Windows Developer Toolkit ( 

Kinect for window sensor status

Create a WPF Application project WPFKinect18 using visual studio 2012.

Add the following references:From the C:\Program Files\Microsoft SDKs\Kinect\v1.8\Assemblies\ folder, add Microsoft.Kinect.dll.

From the C:\Program Files\Microsoft SDKs\Kinect\Developer Toolkit v1.8.0\Assemblies\ folder, add Kinect.Toolkit.dll, Kinect.Toolkit.Controls.dll and Kinect.Toolkit.Interaction.dll

Add the KinectSensorChooserUI to the MainWindow to get the Status of the Kinect sensor. Plugged, unplugged, powered.

And a label control to display the Kinect status change. 

Kinect not connected

Kinect is initializing (you can see the status by hovering on it)

Kinect Connected

Setup the Kinect for interaction

Copy these “KinectInteraction180_32.dll, KinectInteraction180_64.dll” dll’s on the output directory of your project. As shown below (you can find these dll’s in the source code of this article.)

Now change the “SensorChooserOnKinectChanged” event by the following code.

On the mainwindows.xaml

<k:kinectuserviewer k:kinectregion.kinectregion="{Binding ElementName=kinectRegion}" height="150" primaryusercolor="Violet" usercoloringmode="HighlightPrimary" horizontalalignment="Right" verticalalignment="Bottom">

You can see the user depth image on the right bottom of the screen. User is detected in-front of Kinect but not active. The user is looking gray colored

Now the user is active and moving hand and its depth image becomes colored. And you can also see the user’s hand, both hands are track able. You can switch hand cursor control from left hand to right hand easily.

Adding the Kinect tile button inside the Kinect region

<k:kinecttilebutton click="ClickMe_Click" label="Click Me" x:name="ClickMe" />

In the MainWindow.cs page.

private void ClickMe_Click(object sender, RoutedEventArgs e)
            KinectStatus.Content = "Clicked me";

Hover hand on the button on the button

Taking your hand towards Kinect sensor, like pushing a button. Partial pushed button

Pressed button looks like this.

Take you hand back to fire up the click event of this button.

For scrolling area on the Kinect: grip your figures and scroll from left to right and right to left.

Using the code  


<Window x:Class="WPFKinectSDK18.MainWindow"




        Title="MainWindow" Height="450" Width="625" Loaded="Window_Loaded" WindowState="Maximized">
        <k:KinectSensorChooserUI HorizontalAlignment="Center" VerticalAlignment="Top" Name="sensorChooserUi" />
        <Label x:Name="KinectStatus" Content="Kinect status change" 

               HorizontalAlignment="Left" VerticalAlignment="Bottom" FontSize="15"></Label>
        <k:KinectRegion x:Name="kinectRegion">
                <k:KinectUserViewer VerticalAlignment="Bottom" HorizontalAlignment="Right" 

                UserColoringMode="HighlightPrimary" PrimaryUserColor="Violet" Height="150"

                k:KinectRegion.KinectRegion="{Binding ElementName=kinectRegion}" />
                <k:KinectTileButton x:Name="ClickMe" Label="Click Me" Click="ClickMe_Click" VerticalAlignment="Top" HorizontalAlignment="Left"></k:KinectTileButton>
                <k:KinectScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" VerticalAlignment="Center">
                    <StackPanel Orientation="Horizontal" x:Name="StackPanelWithButton" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Kinect;
using Microsoft.Kinect.Toolkit;
using Microsoft.Kinect.Toolkit.Controls;

namespace WPFKinectSDK18
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
        private KinectSensorChooser sensorChooser;
        public MainWindow()
        private void Window_Loaded(object sender, RoutedEventArgs e)
            this.sensorChooser = new KinectSensorChooser();
            this.sensorChooser.KinectChanged += SensorChooserOnKinectChanged;
            this.sensorChooserUi.KinectSensorChooser = this.sensorChooser;
        private void SensorChooserOnKinectChanged(object sender, KinectChangedEventArgs args)
            bool error = false;
            if (args.OldSensor != null)
                    args.OldSensor.DepthStream.Range = DepthRange.Default;
                    args.OldSensor.SkeletonStream.EnableTrackingInNearRange = false;
                catch (InvalidOperationException inEX) { error = true; }

            if (args.NewSensor != null)
                switch (Convert.ToString(args.NewSensor.Status))
                    case "Undefined": KinectStatus.Content = "Undefined"; break;
                    case "Disconnected": KinectStatus.Content = "Disconnected"; break;
                    case "Connected": KinectStatus.Content = "Connected"; break;
                    case "Initializing": KinectStatus.Content = "Initializing"; break;
                    case "Error": KinectStatus.Content = "Error"; break;
                    case "NotPowered": KinectStatus.Content = "NotPowered"; break;
                    case "NotReady": KinectStatus.Content = "NotReady"; break;
                    case "DeviceNotGenuine": KinectStatus.Content = "DeviceNotGenuine"; break;
                    case "DeviceNotSupported": KinectStatus.Content = "DeviceNotSupported"; break;
                    case "InsufficientBandwidth": KinectStatus.Content = "InsufficientBandwidth"; break;
                    default: KinectStatus.Content = "Undefined"; break;
                        args.NewSensor.DepthStream.Range = DepthRange.Near;
                        args.NewSensor.SkeletonStream.EnableTrackingInNearRange = true;
                        args.NewSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
                    catch (InvalidOperationException inEX)
                        args.NewSensor.DepthStream.Range = DepthRange.Default;
                        args.NewSensor.SkeletonStream.EnableTrackingInNearRange = false;
                        error = true;
                catch (InvalidOperationException inEX) { error = true; }
            if (!error) { kinectRegion.KinectSensor = args.NewSensor; }

        private void ClickMe_Click(object sender, RoutedEventArgs e)
            KinectStatus.Content = "Clicked me";

        private void GetTileButtonsForStackPanel()
            for (int i = 1; i <= 35; i++)
                KinectTileButton ObjTileButton = new KinectTileButton();                
                ObjTileButton.Height = 250;
                ObjTileButton.Label = i;
                ObjTileButton.Click += (o, Args) => KinectStatus.Content = "You clicked on tile button : " + i;


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Pankaj Deharia Ignatiuz
Technical Lead Ignatiuz Software Pvt. Ltd.
India India
Working in the projects by using technologies (.Net, C#, MSSQL, Web, Desktop, Kinect based Natural user inter-phase development, dynamic CRM.)

You may also be interested in...

Comments and Discussions

GeneralTrying to see if it works on xbox360 kinect with PC adapter Pin
Victor Ng15-Feb-15 22:11
memberVictor Ng15-Feb-15 22:11 
GeneralRe: Trying to see if it works on xbox360 kinect with PC adapter Pin
Pankaj Deharia25-Sep-15 1:53
professionalPankaj Deharia25-Sep-15 1:53 
QuestionThanks for your tut. Pin
Member 105060958-Apr-14 23:23
memberMember 105060958-Apr-14 23:23 
AnswerRe: Thanks for your tut. Pin
Pankaj Deharia8-Apr-14 23:58
professionalPankaj Deharia8-Apr-14 23:58 
QuestionWhere to buy Kinect for Windows in India Pin
ramatbellcity10-Mar-14 20:42
memberramatbellcity10-Mar-14 20:42 
AnswerRe: Where to buy Kinect for Windows in India Pin
Pankaj Deharia Ignatiuz28-Mar-14 3:56
professionalPankaj Deharia Ignatiuz28-Mar-14 3:56 
QuestionProblem making it run Pin
N. Henrik Lauridsen6-Mar-14 1:40
memberN. Henrik Lauridsen6-Mar-14 1:40 
AnswerRe: Problem making it run Pin
Pankaj Deharia Ignatiuz28-Mar-14 3:43
professionalPankaj Deharia Ignatiuz28-Mar-14 3:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06 | 2.8.190306.1 | Last Updated 24 Dec 2013
Article Copyright 2013 by Pankaj Deharia Ignatiuz
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid