DragDrop Behavior

2 posts, 0 answers
  1. Stanescu Mihai
    Stanescu Mihai avatar
    33 posts
    Member since:
    Aug 2009

    Posted 07 May 2012 Link to this post


    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.
  2. Yana
    Yana avatar
    5013 posts

    Posted 10 May 2012 Link to this post

    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,
    the Telerik team

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

Back to Top