Example #1
0
        /// <summary>
        ///     Starts the dragging operation.
        /// </summary>
        /// <param name="uiElt">The dragged UI element.</param>
        private static void DragStarted(UIElement uiElt)
        {
            isMouseDown = false;
            Mouse.Capture(uiElt);

            // Daten des Drag-Elements holen
            var data = CurrentDragSourceAdvisor.GetDataObject(draggedElt);

            // und diese Daten mit Zusatzinformationen anreichern
            data.SetData(DragOffsetFormat, offsetPoint);
            data.SetData(DragSourceFormat, draggedElt);

            // Die unterstützten DnD-Effekte bei der Drag-Quelle erfragen
            var supportedEffects = CurrentDragSourceAdvisor.SupportedEffects;

            // Perform Drag and Drop operation
            var effects = System.Windows.DragDrop.DoDragDrop(draggedElt, data, supportedEffects);

            // finish DnD operation
            CurrentDragSourceAdvisor.FinishDrag(draggedElt, effects);

            // Clean up
            RemovePreviewAdorner();
            Mouse.Capture(null);
            draggedElt = null;
        }
Example #2
0
        private static void DragStarted(UIElement uiElt)
        {
            _isMouseDown = false;
            if (uiElt == null || _draggedElt == null)
            {
                return;
            }
            //Mouse.Capture(uiElt);

            DataObject data = CurrentDragSourceAdvisor.GetDataObject(_draggedElt);

            data.SetData(DragOffsetFormat, _offsetPoint);
            DragDropEffects supportedEffects = CurrentDragSourceAdvisor.SupportedEffects;

            // Perform DragDrop

            DragDropEffects effects = DragDrop.DoDragDrop(_draggedElt, data, supportedEffects);

            CurrentDragSourceAdvisor.FinishDrag(_draggedElt, effects);

            // Clean up
            RemovePreviewAdorner();
            //Mouse.Capture(null);
            _draggedElt = null;
        }
Example #3
0
        private static void DragStarted(UIElement uiElt)
        {
            _isMouseDown = false;
            Mouse.Capture(uiElt);

            DataObject data = CurrentDragSourceAdvisor.GetDataObject(_draggedElt, _dragStartPoint);

            // NOTE: observed as being null during testing
            if (data != null)
            {
                data.SetData(DragOffsetFormat, _offsetPoint);
                DragDropEffects supportedEffects = CurrentDragSourceAdvisor.SupportedEffects;

                // Perform DragDrop
                DragDropEffects effects = System.Windows.DragDrop.DoDragDrop(_draggedElt, data, supportedEffects);
                CurrentDragSourceAdvisor.FinishDrag(_draggedElt, _dragStartPoint, effects);
            }

            // Clean up
            RemovePreviewAdorner();
            Mouse.Capture(null);
            _draggedElt = null;
        }