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

Upgraded to Q2 2011 and Drag and Drop is now broke

11 Answers 171 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Michelle
Top achievements
Rank 1
Michelle asked on 14 Jul 2011, 10:54 PM
Hello,

I have upgraded to the Q2 2011 version of the ScheduleView (I need the EnableSmallAppointmentRendering).  I have a requirement to drag from a listbox to the ScheduleView to create an appointment and this was all working using Q1 2011 SP1.  I corrected all the compile errors but the drag no longer starts on the listbox.
I checked the samples and noticed that the Drag Drop sample for the ScheduleView was commented out.  I uncommented it and get the same behavior (the drag never starts).

I also tried to set the RadDragAndDropManager.ExecutionMode to DragExecutionMode.Legacy and while that allows the drag to start, it does not appear that the ScheduleView recognizes the drop as no appointment is created.

Please help...I really must have both the drag/drop and the EnableSmallAppointmentRendering.

Thank you,
Michelle

11 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 15 Jul 2011, 07:35 AM
Hi Michelle,

Could you please, open a new support ticket and send us your code that handles the drag-drop? We will reply with instructions how to fix it immediately.

Best wishes,
Valeri Hristov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Michelle
Top achievements
Rank 1
answered on 15 Jul 2011, 04:35 PM
Thank you.  I have submitted a support ticket (443973) along with a sample application.

Regards,
Michelle
0
Rod Yager
Top achievements
Rank 1
answered on 26 Jul 2011, 08:44 PM
I am having a similar problem. I changed the executionmode that at least enabled me to start my drag from a listview, however now in my drag behavior handler, the appointments coming across as being dragged are no longer the custom appointment objects that I specified in the payload for the drag query handler. Any ideas?
Rod


0
Valeri Hristov
Telerik team
answered on 27 Jul 2011, 11:13 AM
Hello Rod,

I would need your code to provide more specific advice, but you could check if in the ConvertDraggedData method you are returning the correct appointments.

Greetings,
Valeri Hristov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Rod Yager
Top achievements
Rank 1
answered on 27 Jul 2011, 02:20 PM
My DragQuery Handler where my custom Appt objects are instantiated...
protected virtual void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {           
            if (e.Options.Status == DragStatus.DragQuery)
            {
                ListView mlv = sender as ListView;
                ObservableCollection<MetrixTaskAppointment> appointments = new ObservableCollection<MetrixTaskAppointment>();
                if (mlv.SelectedItems.Count == 0)
                {
                    return;
                }
 
                DataView resultListSource = mlv.ItemsSource as DataView;
 
                foreach (DataRowView drv in mlv.SelectedItems)
                {
                    MetrixTaskAppointment appointment = new MetrixTaskAppointment();
                    appointment.Start = DateTime.Now;
                    appointment.End = DateTime.Now.AddMinutes(60);
 
                    appointments.Add(appointment);
                }
 
                if (appointments.Count > 0)
                {
                    e.Options.DragCue = CreateDragCue(appointments);
                    ScheduleViewDragDropPayload payload = new ScheduleViewDragDropPayload(null, appointments);
                    e.Options.Payload = payload;
                }
            }
 
            e.QueryResult = true;
        }

My custom DragDropBehavoir class. On drop, the dragged appointments are not my MetrixTaskAppointments anymore. They come accross as just Appointments. This used to work before upgrading to the Q2 controls.

public class RepairBoardDragDropBehavior : ScheduleViewDragDropBehavior
    {
        public override void Drop(DragDropState state)
        {
            bool hasErrors = false;
 
            foreach (IAppointment a in state.DraggedAppointments)
            {
                PersonResource personResource = state.DestinationSlots.First().Resources[0] as PersonResource;
                string personId = personResource.PersonId;
                DateTime slotStart = state.DestinationSlots.First().Start;
                //The next line now fails
                DataView dv = (a as MetrixTaskAppointment).ResultListViewSource as DataView;               
            }
 
            if (hasErrors == false)
                base.Drop(state);
        }
    }


0
Yana
Telerik team
answered on 01 Aug 2011, 12:51 PM
Hi Rod,

You should also override ConvertDraggedData method in ScheduleViewDragDropBehavior in order to return the custom appointments. I've attached an example project which demonstrates drag and drop between RadScheduleView and ListView. Please note that you should download the latest internal build (2011.2.725) which contains a fix of the drag and drop functionality and run the project with it.

Hope this helps.

Best wishes,
Yana
the Telerik team

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

0
Rod Yager
Top achievements
Rank 1
answered on 01 Aug 2011, 04:04 PM
Thanks for the example, but is there no way to convert my list DataRowView into my custom appointment object in the DragQuery handler? My list doesn't and won't contain my custom appointment object. They must be converted when dragging. As you can see in my example, this was an ObservableCollection that was added to the payload. Can you provide an example using the code that I have?

FYI, I could not get your example to work at all. The DataObject always came back null.

Also, not sure if this matters, but I have the following properites set in the App.xaml.cs. I have other functionality that requires drag/drop from the desktop to a listview. This all used to work before the latest upgrade.


RadDragAndDropManager.ExecutionMode = DragExecutionMode.Legacy;
RadDragAndDropManager.EnableNativeDrag = true;

Thanks,
Rod

0
Michelle
Top achievements
Rank 1
answered on 01 Aug 2011, 08:20 PM
It looks like the Internal build 2011.2.275 has been taken down from the download site.  When will it be available again?

Thank you,Michelle
0
Yana
Telerik team
answered on 02 Aug 2011, 02:05 PM
Hello,

The new internal build  (2011.2.0801) is already uploaded, you can download it from your account.

There are some changes in RadDragAndDropManager and DragDropBehavior of the ScheduleView, that's why your current code is not supposed to work.  RadScheduleView should take care of the items which are dropped into it - that is why the appointments are converted in its DragDropBehavior ConvertDraggedData method.

Please remove the settings of RadDragAndDropManager in App.xaml.cs and try the project again.

Kind regards,
Yana
the Telerik team

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

0
Rod Yager
Top achievements
Rank 1
answered on 03 Aug 2011, 02:45 PM
OK, I finally got it working again. Thanks! The key was to add the following property on my ListViewItem (won't work without it)...
<Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />

And I removed the following lines from the app.xaml.cs...
RadDragAndDropManager.ExecutionMode = DragExecutionMode.Legacy;
RadDragAndDropManager.EnableNativeDrag = true;

I also verified that my dragging of external desktop files into listviews still works without having to set the EnableNativeDrag property. So far so good.
When will the these fixes be published as an official release? We have a software code release coming up in a month and I would like this fix in a formal release if possible.

Thanks for you help!
0
Yana
Telerik team
answered on 03 Aug 2011, 03:04 PM
Hi Rod,

I'm glad that the drag and drop is already working.

The next official release (Q2 SP1) is expected in mid-September.

Regards,
Yana
the Telerik team

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

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