1
votes

I am creating a desktop application and navigation will be done by using Kinect. (I am using the new interactions introduced in the 1.7 SDK).

I followed an online tutorial and I also noticed a few users complaining about this memory problem.

To be able to navigate using your hand there needs to be a Kinect region on your form and you need to bind a sensor to that region.

// Bind the sensor chooser's current sensor to the KinectRegion 
var regionSensorBinding = new Binding("Kinect") { Source = this.sensorChooser }; 
BindingOperations.SetBinding(this.kinectRegion, KinectRegion.KinectSensorProperty, regionSensorBinding);

I narrowed the memory problem down to those 2 lines.

Every time I now change pages:

(Application.Current.MainWindow.FindName("_mainFrame") as Frame).Source = new Uri("MainMenu.xaml", UriKind.Relative);

The memory usage increases (which is understandable), but it never goes down.

That section of code is on every new page to bind my sensor to that page's kinect region.

Any ideas on why this might be or how I can correct this?

PS: I am using the KinectSensorChooser as in the tutorial, if that makes a difference.

1

1 Answers

0
votes

I finally found a way to fix the binding problem.

I just cleared the binding when I navigate away from the page:

BindingOperations.ClearBinding(this.kinectRegion, KinectRegion.KinectSensorProperty);

Should anybody come across this memory problem, go visit this page to see how WPF actually handles pages transitions, which was actually my real problem.