/// <summary> /// Initiates a drag-and-drop operation and start drag item preview with mouse. /// </summary> private static void DragStarted() { isMouseDown = false; Mouse.Capture(dragElement); IDataObject data = currentSourceAdvisor.GetDataObject(dragElement); DragDropEffects supportedEffects = currentSourceAdvisor.SupportedEffects; // Perform DragDrop DragDropEffects effects = System.Windows.DragDrop.DoDragDrop(dragElement, data, supportedEffects); currentSourceAdvisor.OnDropConfirmed(dragElement, effects); // Clean up EndDragDrop(); }
private static void DragStarted(UIElement uiElement) { s_IsMouseDown = false; Mouse.Capture(uiElement); IDragSourceAdvisor advisor = GetDragSourceAdvisor(uiElement); DataObject data = advisor.GetDataObject(s_DraggedElement, s_OffsetPoint); DragDropEffects supportedEffects = advisor.SupportedEffects; // Perform DragDrop DragDropEffects effects = DragDrop.DoDragDrop(s_DraggedElement, data, supportedEffects); advisor.FinishDrag(s_DraggedElement, effects); // Clean up RemovePreviewAdorner(); Mouse.Capture(null); s_DraggedElement = null; }