title: KinectColorViewer and SDK 1.6
body: <p>I'm new to Kinect and VS Development, and I was using the <a href="http://channel9.msdn.com/Series/KinectQuickstart" rel="nofollow noreferrer">Windows Kinect Quickstart Series</a>, but unfortunately, it was meant for Kinect SDK v1.00.</p>
  
  <p>I got stuck on KinectColorView usage, and I'cant proceed (I have been Googlin' for 2 days now). I also found this very similar question: <a href="https://stackoverflow.com/questions/12609858/using-kinectcolorviewer-in-sdk1-5">Using KinectColorViewer in SDK1.5</a> here on StackOverflow but couldn't solve my problem. I know that I'm close, but i need help.</p>
  
  <p><strong>The problem is: that I can't get my KinectColorViewer to work.</strong></p>
  
  <p>I added it to the XAML designer, but it seems I can't bind it to the SensorManager. 
  Here is my XAML code:</p>
  
  <pre><code>&lt;Window
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:WpfViewers="clr-namespace:Microsoft.Samples.Kinect.WpfViewers;assembly=Microsoft.Samples.Kinect.WpfViewers" xmlns:Toolkit="clr-namespace:Microsoft.Kinect.Toolkit;assembly=Microsoft.Kinect.Toolkit" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="KinectSetupDev.MainWindow"
      Title="MainWindow" Height="768" Width="1024" Loaded="Window_Loaded_1" Closed="Window_Closed_1"&gt;
  
      &lt;Grid HorizontalAlignment="Left" Height="736" VerticalAlignment="Top" Width="1012" Margin="2,2,0,0"&gt;
           &lt;TextBlock x:Name="tbMessages" HorizontalAlignment="Left" Height="60" Margin="10,662,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="992"/&gt;
           &lt;WpfViewers:KinectColorViewer x:Name="KinectColorViewer" KinectSensorManager="{Binding KinectSensorManager}" HorizontalAlignment="Left" Height="240" Margin="608,27,0,0" VerticalAlignment="Top" Width="320" BorderThickness="1" BorderBrush="Black"/&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>Nothing to report about the XAML code, except that i had to add the chunk</p>
  
  <pre><code>"KinectSensorManager="{Binding KinectSensorManager}"
  </code></pre>
  
  <p>in the KinectColorViewer item by writing it, because I couldn't find the way to this by the XAML designer's GUI (so I have some doubts about its viability).</p>
  
  <p>Here is my code-behind (<em>I almost totally copied it by the question: <a href="https://stackoverflow.com/questions/12609858/using-kinectcolorviewer-in-sdk1-5">Using KinectColorViewer in SDK1.5</a> so I can't understand why it's not working!!</em>)</p>
  
  <pre><code>namespace KinectSetupDev
  {
    public partial class MainWindow : Window
    {
      // Automatically finds a Kinect for you.
      private readonly KinectSensorChooser sensorChooser = new KinectSensorChooser();
  
      public KinectSensorManager KinectSensorManager01 { get; private set; }
  
      public MainWindow()
      {
          InitializeComponent();
          DataContext = this;
  
      }
  
      private void Window_Loaded_1(object sender, RoutedEventArgs e)
      {
          // Initialize the Kinect sensor manager.
          KinectSensorManager01 = new KinectSensorManager();
          KinectSensorManager01.KinectSensorChanged += this.KinectSensorChanged;
  
          // Locate an available sensor.
          sensorChooser.Start();
  
          // Bind chooser's sensor value to the local sensor manager.
          var kinectSensorBinding = new Binding("Kinect") { Source = this.sensorChooser };
          BindingOperations.SetBinding(this.KinectSensorManager01, KinectSensorManager.KinectSensorProperty, kinectSensorBinding);
      }
  
      private void Window_Closed_1(object sender, EventArgs e)
      {
          UninitializeKinectServices(KinectSensorManager01.KinectSensor);
      }
  
      #region Kinect Discovery &amp; Setup
  
      private void KinectSensorChanged(object sender, KinectSensorManagerEventArgs&lt;KinectSensor&gt; args)
      {
          if (null != args.OldValue)  
              UninitializeKinectServices(args.OldValue);
  
          if (null != args.NewValue)
              InitializeKinectServices(KinectSensorManager01, args.NewValue);
      }
  
      // Kinect enabled apps should customize which Kinect services it initializes here.
      private void InitializeKinectServices(KinectSensorManager kinectSensorManager, KinectSensor sensor)
      {
          // Application should enable all streams first.
          kinectSensorManager.ColorStreamEnabled = true;
          kinectSensorManager.DepthStreamEnabled = true;
          kinectSensorManager.SkeletonStreamEnabled = true;
  
          // Start the sensor!
          try
          {
              sensor.Start();
              sensorChooser.Kinect.ElevationAngle = 10;
              tbMessages.Text = "Kinect Started";
          }
          catch (System.IO.IOException)
          {
              sensor = null;
              tbMessages.Text = "Kinect Not Started" + "\r";
          }
      }
  
      // Kinect enabled apps should uninitialize all Kinect services that were initialized in InitializeKinectServices() here.
      private void UninitializeKinectServices(KinectSensor sensor)
      {
          if (sensor != null)
          {
  
              if (sensor.IsRunning)
              {
                  sensorChooser.Kinect.ElevationAngle = 0;
                  sensor.Stop();
                  sensor.AudioSource.Stop();
  
              }
          }
      }
  
      #endregion Kinect Discovery &amp; Setup
  
    }
  }
  </code></pre>
  
  <p>I tried to add the line  <code>DataContext = this;</code>  in the contructor, but it does not work.</p>
  
  <p><strong>The application runs, my Kinect starts but the KinectColorViewer does not show anything.</strong></p>
  
  <p><em>Moreover, can anyone tell the difference between</em>  <code>sensor.SkeletonStream.Enable();</code> 
  <em>and</em>  <code>kinectSensorManager.SkeletonStreamEnabled = true;</code>  <em>??</em></p>