Home › Forums › Software Development › EyeX in WPF application › Reply To: EyeX in WPF application
23/07/2014 at 13:39 #1417
Jenny [Tobii]
Participant
Hi Saad,
Since the bug was situated in the middle of a double recursive loop, I felt bad not providing a solution. So, I took a look at it, and this is a quick solution I came up with.
I have only tested that it works with the WPF samples included in the SDK. Please, replace the existing implementation of GetChildInteractorElements in EyeXFramework.Wpf.WpfCrawler with the following, and let me know if it works for your application or not!
private static IEnumerable<FrameworkElement> GetChildInteractorElements(DependencyObject parent) { for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++) { var childDependencyObject = VisualTreeHelper.GetChild(parent, i); var childFrameworkElement = childDependencyObject as FrameworkElement; if (null != childFrameworkElement && childFrameworkElement.IsInteractor()) { yield return childFrameworkElement; } else { foreach (var grandchild in GetChildInteractorElements(childDependencyObject)) { yield return grandchild; } } } }