Microsoft.Kinect.KinectSensor' does not contain a definition for 'KinectSensors' RRS feed

  • Question

  • What should I do when the error Microsoft.Kinect.KinectSensor' does not contain a definition for 'KinectSensors' comes?

    I am beginning to work with Kinect v2 and have no prior experience in kinect or C#. I am trying to run an example from a textbook. I have added the Microsoft.Kinect reference to the project.

    The code is given below:


    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;

    namespace ch1_1
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
            private KinectSensor _Kinect;
            public MainWindow()

                this.Loaded += (s, e) => { DiscoverKinectSensor(); };
                this.Unloaded += (s, e) => { this.Kinect = null; };

            private void DiscoverKinectSensor() {
                KinectSensor.KinectSensors.StatusChanged += KinectSensors_StatusChanged;
                this.Kinect = KinectSensor.KinectSensors.FirstOrDefault(x => x.Status == KinectStatus.Connected);

            private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e) {
                case KinectStatus.Connected:
                    if (this.Kinect == null)
                        this.Kinect = e.Sensor;

                case KinectStatus.Disconnected:
                    if (this.Kinect == e.Sensor)
                        this.Kinect = null;
                        this.Kinect = KinectSensor.KinectSensors.FirstOrDefault(x => x.Status == KinectStatus.Connected);

                        if (this.Kinect == null)
                        { }

            public KinectSensor Kinect
                get {return this._Kinect;}

                set {
                    if(this._Kinect != value)
                        this._Kinect = null;

                    if(value != null && value.Status == KinectStatus.Connected)
                    {this._Kinect = value;}


    Friday, April 15, 2016 1:28 PM

All replies

  • this also gives the same error for

    1. KinectStatus

    2. Status

    3. StatusChangedEventArgs

    also says 'Microsoft.Kinect.KinectSensor' does not contain a definition for 'Status' and no extension method 'Status' accepting a first argument of type 'Microsoft.Kinect.KinectSensor' could be found (are you missing a using directive or an assembly reference?) 

    Can somebody tell me what I am missing here?


    Friday, April 15, 2016 1:41 PM
  • Hello Laksi,

    If you are really working with Kinect 2 for Windows, then you should use different learning material because the one from which you included source code in your message is from Kinect 1.x API which is different from Kinect 2 API. A lot of refactoring (classes, methods etc.) was done between v1 & v2 API.

    Kinect 2 API supports only a single sensor, therefore collection


    is not available in v2 API

    To access Kinect sensor you should use

    I suggest you to use samples in SDK's sample browser as your learning material instead of your textbook which targets original Kinect for Windows (v1) 

    • Proposed as answer by Jan Marcincin Sunday, April 17, 2016 10:07 PM
    Sunday, April 17, 2016 10:06 PM