Home Forums Software Development Eye-aware WPF within eye-aware Win Form Reply To: Eye-aware WPF within eye-aware Win Form

Sai Prasad

I’m working with @flyingrobin on this one. We took MainWindow.xaml and MainWindow.xaml.cs from the Tobii WpfSample project “GazeAwareElements” and converted it into a Wpf UserControl. We then did the following:
1. Embedded the Wpf UserControl into into a WinForm. None of the Gaze events triggered.
2. Embedded the Wpf UserControl (without making any code changes) into a Wpf Form. All the Gaze events triggered.

Case #2 proves that the Wpf UserControl is working correctly. Then, why aren’t the Gaze events triggering when it is embedded into a WinForm? In both cases, we are initializing and starting WpfEyeXHost inside the constructor of the Wpf UserControl.

We also tried explicitly adding a Gaze handler for the UserControl as below:
EyeXFramework.Wpf.Behavior.AddHasGazeChangedHandler(this, new RoutedEventHandler(handler));

So when the gaze falls on the control, the event should trigger. It does, when the control is hosted in a Wpf form. But doesn’t trigger when it is hosted in a WinForm.