Crash After jump in a new WPF using user control

Jan 17, 2013 at 3:57 PM
Edited Jan 17, 2013 at 4:00 PM

Hi guys, i'm tring to make an application that run in a single window using kinect.

I'm merging project with the KinectUI.

After all the project start and run well if I use the mouse, but using the Kinect I have a crash every time I'm going to open a new page.

I have 3 buttons with magnetic sets on true, the application crash after the progress bar loading.

What could be the problem?

Thanks at all who will answer.

Visual Studio bring me here:


                foreach (FrameworkElement element in MagneticsControl)
                    // Getting the four corners
                    var position = element.TransformToAncestor(rootVisual).Transform(new Point(0, 0));
                    var p1 = new Vector2((float)position.X, (float)position.Y);
                    var p2 = new Vector2((float)(position.X + element.ActualWidth), (float)position.Y);
                    var p3 = new Vector2((float)(position.X + element.ActualWidth), (float)(position.Y + element.ActualHeight));
                    var p4 = new Vector2((float)position.X, (float)(position.Y + element.ActualHeight));
Jan 18, 2013 at 6:53 AM

Could you share the exception raised? 

Jan 18, 2013 at 12:15 PM

Hi Deltakosh, thanks for you reply.

The program crash after open the new usercontrol page and the PresenceControll load again the skeleton.

This is the exception

System.InvalidOperationException occurred  HResult=-2146233079  Message=(Current Visual is not main parent of this Visual) Il Visual specificato non è un predecessore di questo Visual.  Source=PresentationCore  StackTrace:       in System.Windows.Media.Visual.TrySimpleTransformToAncestor(Visual ancestor, Boolean inverse, GeneralTransform& generalTransform, Matrix& simpleTransform)       in System.Windows.Media.Visual.TransformToAncestor(Visual ancestor)       in Kinect.Toolbox.MouseController.SetHandPosition(KinectSensor sensor, Joint joint, Skeleton skeleton) in c:\Users\Alessandro\Documents\Visual Studio 2012\Projects\Kinect Toolbox\Sources\Mouse\MouseController.cs:riga 281  InnerException: