private AutomationElement ListItemElementFromPoint(AutomationElementFactory factory, Point pt) { if (PInvoke.WindowFromPoint(pt) != Handle) { return(null); } AutomationElement elem = factory.FromPoint(pt); if (elem == null) { return(null); } if (elem.GetClassName() == "UIItem") { return(elem); } elem = elem.GetParent(); if (elem == null) { return(null); } if (elem.GetClassName() == "UIItem") { return(elem); } return(null); }
public override bool PointIsBackground(Point pt, bool screenCoords) { if (!screenCoords) { PInvoke.ClientToScreen(ListViewController.Handle, ref pt); } return(AutomationManager.DoQuery(factory => { AutomationElement elem = factory.FromPoint(pt); if (elem == null) { return false; } string className = elem.GetClassName(); return className == "UIItemsView" || className == "UIGroupItem"; })); }