コード例 #1
0
ファイル: DragDropManager.cs プロジェクト: rafysanchez/Apollo
        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;
        }
コード例 #2
0
        static void DragStarted(object uiObject)
        {
            // prepare
            DragSource.IsMouseDown = false;
            Mouse.Capture(DragSource.DraggedElement);

            // gather data
            IDragSourceAdvisor adv              = GetDragSourceAdvisor(uiObject as UIElement);
            DataObject         data             = DragSource.SourceAdvisor.GetDataObject(DragSource.DraggedElement, DragSource.StartPoint);
            DragDropEffects    supportedEffects = adv.SupportedEffects;

            adv.SourceUI = uiObject as UIElement;

            // Perform DragDrop
            DragDropEffects effects = System.Windows.DragDrop.DoDragDrop(DragSource.DraggedElement, data, supportedEffects);

            adv.FinishDrag(DragSource.DraggedElement, effects);

            // Clean up
            Mouse.Capture(null);
            DragSource   = null;
            adv.SourceUI = null;
        }