static void BuildElementsList(UIElementsList list, DependencyObject over) { if(!list.Contains(over)) { list.Add(over, ContactState.New); DependencyObject visualParent = over is Visual ? VisualTreeHelper.GetParent(over) : null; DependencyObject logicalParent = LogicalTreeHelper.GetParent(over); if(visualParent != null) BuildElementsList(list, visualParent); if(logicalParent != null && logicalParent != visualParent) BuildElementsList(list, logicalParent); } }
static void RaiseEnterLeave(Contact contact, UIElementsList list) { foreach (DependencyObject treeElement in list) { ContactState state = list.GetState(treeElement); switch (state) { case ContactState.New: RaiseEnterLeaveEvents(contact, treeElement, MultitouchScreen.ContactEnterEvent); break; case ContactState.Removed: RaiseEnterLeaveEvents(contact, treeElement, MultitouchScreen.ContactLeaveEvent); break; } } }
static UIElementsList BuildElementsList(RawMultitouchReport report, DependencyObject newOver, UIElementsList oldList, out UIElementsList mergedList) { UIElementsList newList = null; if (newOver != null) { newList = new UIElementsList(newOver); if (!report.CleanUp) BuildElementsList(newList, newOver); } mergedList = UIElementsList.BuildDifference(newList, oldList); return newList; }