Ejemplo n.º 1
0
        protected virtual ListBoxEditItem GetVisibleHitTestElement(Point pt)
        {
            DragDropHitTestResult result = new DragDropHitTestResult();

            VisualTreeHelper.HitTest(ListBox, null, new HitTestResultCallback(result.CallBack), new PointHitTestParameters(pt));
            return(result.Element);
        }
		protected UIElement GetVisibleHitTestElement(Point pt) {
			DragDropHitTestResult result = new DragDropHitTestResult(this);
#if SL
			UIElement root = LayoutHelper.FindRoot(DataControl) as UIElement;
			Point location = LayoutHelper.GetRelativeElementRect(DataControl, root).TopLeft();
			System.Windows.Controls.Primitives.Popup popup = root as System.Windows.Controls.Primitives.Popup;
			if(popup!=null)
				PointHelper.Offset(ref location, popup.HorizontalOffset, popup.VerticalOffset);
			PointHelper.Offset(ref location, pt.X, pt.Y);
			HitTestHelper.HitTest(DataControl, null, new HitTestResultCallback(result.CallBack), new PointHitTestParameters(location), true);
#else
			VisualTreeHelper.HitTest(DataControl, null, new HitTestResultCallback(result.CallBack), new PointHitTestParameters(pt));
#endif
			return result.Element;
		}