public static void SetDragDropPreviewControl(DependencyObject element,DragPreview value) { element.SetValue(DragDropPreviewControlProperty,value); }
private void DragSource_PreviewMouseMove(object sender,MouseEventArgs e) { _dragDropPreview = GetDragDropPreviewControl(sender as DependencyObject); if (_dragDropPreview != null&&_dragDropContainer!=null) { _dragDropPreview.Opacity = 0.7; _dragDropContainer.Children.Add(_dragDropPreview); Mouse.Capture(_dragDropPreview); Mouse.OverrideCursor = Cursors.Hand; Canvas.SetLeft(_dragDropPreview, _initialMousePosition.X - 20); Canvas.SetTop(_dragDropPreview, _initialMousePosition.Y - 15); } }