This is a migrated thread and some comments may be shown as answers.

How to do action after drag/drop operation

3 Answers 188 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Rod Yager
Top achievements
Rank 1
Rod Yager asked on 25 Aug 2011, 07:11 PM
I have two instances where I drag appointment onto the ScheduleView. Once dragging from a listview to the scheduleview, and once when you drag within the scheduleview. In both cases I would like to complete some kind of action after the drop is completed. I have added the appropriate drop info handler but it never gets hit. I do have a custom drag behavior that handles the drop action itself. What do I have to do to make something happen after the drop is completed. OnDropInfo never fires...
//Drag and Drop handlers to the result listview and ScheduleView
            RadDragAndDropManager.AddDragQueryHandler(resultListView, OnDragQuery);
            RadDragAndDropManager.SetAllowDrop(taskBoardScheduleView, true);
            RadDragAndDropManager.AddDropInfoHandler(taskBoardScheduleView, OnDropInfo);
            taskBoardScheduleView.DragDropBehavior = new TaskBoardDragDropBehavior();


protected virtual void OnDropInfo(object sender, DragDropEventArgs e)
        {
            if (e.Options.Status == DragStatus.DropComplete)
            {
                RefreshScheduleView();
                //DateSpan dateSpan = new DateSpan(taskBoardScheduleView.VisibleRange.Start, taskBoardScheduleView.VisibleRange.End);
                //viewModel.GetTaskAppointments(dateSpan);
            }
        }

3 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 26 Aug 2011, 07:40 AM
Hi Rod,

Isn't the DragDropBehavior.Drop(DragDropState) method not enough for you to achieve your goal? It was designed to be overriden in cases when you need to do something after the drop operation over RadScheduleView is completed.

And you are right about the RadDragAndDropManager events not being risen when you drag-drop over RadScheduleView - this is because the scheduleview control uses a different drag-drop framework, that is going to replace RadDragAndDropManager in the near future (we will keep the old one for compatibility, though, but it probably will not work in many cases like ScheduleView for example).

All the best,
Valeri Hristov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Rod Yager
Top achievements
Rank 1
answered on 13 Sep 2011, 02:55 PM
Valeri, I'm not sure if the DragDropBehavior.Drop(DragDropState) is enough right now. What I want to do is a refresh of my ScheduleView but from within the DragDropBehavior class I have nothing that points back to my ScheduleView class with all it's methods.

Rod
0
Valeri Hristov
Telerik team
answered on 20 Sep 2011, 02:13 PM
Hi Rod,

I apologize for not answering so long. There are ways to get the internals of RadScheduleView from the DragDropBehavior, but we are still working on these APIs and they most probably will change in the near future, hence I would not recommend using them. One possible workaround would be to bind your ViewModel to the DragDropBehavior - this is possible because the latter is a DependencyObject. You will need to create a class, deriving from DragDropBehavior and add a few dependency properties that could be bound to the propoerties in the ViewMoldel.

Probably if you elaborate on this I could provide more specific advice.

Kind regards,
Valeri Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ScheduleView
Asked by
Rod Yager
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Rod Yager
Top achievements
Rank 1
Share this question
or