This is a migrated thread and some comments may be shown as answers.
DragDrop Behavior
1 Answer 32 Views
This is a migrated thread and some comments may be shown as answers.
Stanescu Mihai
Top achievements
Rank 1
Stanescu Mihai asked on 07 May 2012, 01:41 PM
Hello,

I have implemented a ScheduleViewDragDropBehavior in an MVVM project and was wondering if and how can I trigger an event from the Drop method in the viewmodel.
I am dragging from a different control which holds different types of data then the ScheduleView, the reason I need that event is to trigger a save whenever a new appointment is added this way.

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 10 May 2012, 08:46 AM
Hi Stanescu,

I am afraid that you cannot trigger the Drop event in the ViewModel of the ScheduleView, but you can get the ViewModel in the event handler.  There are two ways:
  • using the following method:

var scheduleView = state.ServiceProvider.GetService<IObjectEditor<IAppointment>>() as RadScheduleView;

and then scheduleView.DataContext;
  • create a property for the ViewModel at your custom behavior and set it once the page is initialized.

Hope this helps.


All the best,
Yana
the Telerik team

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

Asked by
Stanescu Mihai
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or