1

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.

4

1 回答 1

0

我终于找到了解决绑定问题的方法。

当我离开页面时,我刚刚清除了绑定:

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

如果有人遇到此内存问题,请访问此页面以查看 WPF 实际如何处理页面转换,这实际上是我真正的问题。

于 2013-07-16T14:24:40.180 回答