private static void Target_Drop(object sender, DragEventArgs e) { var targetElement = sender as FrameworkElement; var targetModel = TreeFinder.FindInterface <IDragData>(targetElement); if (targetModel == null) { Debug.Assert(false, "In order to complete drag operation IDragData must be implement by the source."); } Point pos = e.GetPosition(targetElement); targetModel.SetDropObject(e.Data.GetData(ObjectType), (int)pos.X, (int)pos.Y); }
private static void Source_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { IDragData source = TreeFinder.FindInterface <IDragData>(sender as FrameworkElement); if (source == null) { Debug.Assert(false, "In order to complete drag operation IDragData must be implement by the source."); } var dragObject = source.GetDragObject( ); ObjectType = dragObject.GetType( ); DragDrop.DoDragDrop(sender as DependencyObject, dragObject, DragDropEffects.Copy); }