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

Old DragDrop Behavior

3 Answers 60 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Vic
Top achievements
Rank 2
Vic asked on 01 Sep 2011, 05:16 PM
Hello,

We are in the process of upgrading from the old Schedule control and would like to implement the same old drag/drop behavior.

Basically I am trying to achieve is when resizing/dragging or dragging/dropping update the time of the appointment w/o displaying the appointment form.

I have a custom behavior in place and can suppress the dialog by not calling the base (base.Resize, etc) methods but the appointment items in the UI are not updating.

Updating the appointment in state.SourceAppointmentsSource collection doesn't seem to work.

I am thinking at this point I need to send a message to my ViewModel to update the main AppointmentSource but wanted to know if there was a cleaner way to achieve this.

Thanks,
Vic


3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 06 Sep 2011, 10:53 AM
Hi Vic,

We're not sure what exactly is your setup. Could you please send us a sample code/project with the used custom DragDropBehavior,  so we to be able to test the scenario and assist you to achieve the needed approach? Thanks

Regards,
Yana
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
Vic
Top achievements
Rank 2
answered on 07 Sep 2011, 11:02 PM
Hi Yana,

Here is the Resize override, I have reorganized the code and the SourceAppointmentsSource is correct, though updating the source appointment doesn't cause the binding to update the UI.

What am I missing?

Thanks,
Vic
public override void Resize(DragDropState state)
        {
            // update the dates if changed (this is not recurrence aware)
            var appt = state.Appointment as Telerik.Windows.Controls.ScheduleView.Appointment;
            var targetSlot = state.DestinationSlots.FirstOrDefault();
 
            if (appt == null || (targetSlot == null || (appt.Start == targetSlot.Start && appt.End == targetSlot.End))) return;
 
                  
           var thisAppointment = state.SourceAppointmentsSource.OfType<Telerik.Windows.Controls.ScheduleView.Appointment>().FirstOrDefault(a => a.UniqueId == appt.UniqueId);             if (thisAppointment != null)             {                 thisAppointment.Start = targetSlot.Start;                 thisAppointment.End = targetSlot.End;             }             //base.Resize(state);         }
0
Vic
Top achievements
Rank 2
answered on 07 Sep 2011, 11:51 PM
I was able to get this to work by sending a message from the custom Drag/Drop behavior to my ViewModel to perform the appropriate update.

Thanks for following up

-Vic
Tags
ScheduleView
Asked by
Vic
Top achievements
Rank 2
Answers by
Yana
Telerik team
Vic
Top achievements
Rank 2
Share this question
or