public static void DoDragDrop(DependencyObject dragSource, object data, DragDropEffects allowedEffects, DragDropCompletedCallback onDragDropCompleted) { DragDropCallbackInfo info = new DragDropCallbackInfo { Callback = onDragDropCompleted }; int callbackId = info.GetHashCode(); _dragDropCallbacks[callbackId] = info; DoDragDropHelper(dragSource, data, allowedEffects, callbackId, _dragDropCompleted); }
private static void OnDragDropCompleted(int callbackId, IntPtr source, IntPtr data, IntPtr target, IntPtr dropPoint, int effects) { try { DragDropCallbackInfo info = _dragDropCallbacks[callbackId]; info.Callback((DependencyObject)Extend.GetProxy(source, false), new DataObject(Extend.GetProxy(data, false)), (UIElement)Extend.GetProxy(target, false), Marshal.PtrToStructure <Point>(dropPoint), (DragDropEffects)effects); _dragDropCallbacks.Remove(callbackId); } catch (Exception e) { Noesis.Error.UnhandledException(e); } }