private void CheckAndExecuteDrop(GalaxyAdorner adorner, Point touchPoint) { VisualTreeHelper.HitTest(DragOverlay, null, new HitTestResultCallback(MyHitTestResult), new PointHitTestParameters(touchPoint)); foreach (UIElement item in hitResultsList) { if (item is IDroppableArea) { IDroppableArea area = item as IDroppableArea; area.Drop(adorner); } } hitResultsList.Clear(); }
/// <summary> /// This function occurs when any element on the canvas is dropped /// </summary> /// <param name="sender">Originating element</param> /// <param name="args">Event args</param> private void Element_ElementDropped(object sender, DraggableElementEventArgs args) { IDroppableArea finalDropTarget = null; foreach (UIElement child in Children) { if (child is IDroppableArea) { IDroppableArea dropTarget = child as IDroppableArea; if (dropTarget != args.Element && dropTarget.IsUnder(args.DragPosition)) { finalDropTarget = dropTarget; } } } if (finalDropTarget != null) { finalDropTarget.Drop(args.Element); } }