sk8ergirl 0 Newbie Poster

I followed one of the tutorial to have hand cursor and when I run my app I couldn't see the hand cursor or the userviewer
I was expecting something like this

but nothing happened when I run my programme I only saw the button I spent hours trying to fix it but I didn't know what is wrong with my code
here is my code

<Window x:Class="handMovement.MainWindow"

        Title="MainWindow" Height="350" Width="525">
        <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="green" 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" />


and here is my code

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 handMovement
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
        private KinectSensorChooser sensorChooser;

        public MainWindow()
            Loaded += load; 
        private void load(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;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.