protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) { if (sizeInfo == null) { throw new ArgumentNullException("sizeInfo"); } base.OnRenderSizeChanged(sizeInfo); if (sizeInfo.HeightChanged || sizeInfo.WidthChanged) { if (this.depthImageProcessor != null) { this.depthImageProcessor.ProcessedDepthImageReady -= this.OnDepthImageProcessorImageReady; this.depthImageProcessor.Dispose(); } this.depthImageProcessor = new DepthImageProcessor { TargetWidth = (int)sizeInfo.NewSize.Width, TargetHeight = (int)sizeInfo.NewSize.Height, PrimaryUserColor = this.PrimaryUserColor, UserColoringMode = this.UserColoringMode, UserColors = this.UserColors, DefaultUserColor = this.DefaultUserColor, KinectRegion = this.kinectRegionBinder.KinectRegion, KinectSensor = this.kinectRegionBinder.KinectSensor }; this.depthImageProcessor.ProcessedDepthImageReady += this.OnDepthImageProcessorImageReady; } }