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

Drag and Drop

22 Answers 394 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 19 Apr 2011, 03:18 PM
Hi,

we try to migrate our project from RadScheduler to RadScheduleView and have some difficulties. We want to drop non-appointment items onto RadScheduleView and convert them to appointments.
In RadScheduler I had to set the AllowDropProperty of each TimeSlotItem to true, as described here http://www.telerik.com/help/silverlight/raddraganddrop-items-onto-radscheduler.html, but in RadScheduleView I can't do that because TimeSlotItem does not exist. Simply setting AllowDrop to true in RadScheduleView isn't working either, because I want to create appointments at the current mouse position.
I added the handlers via
 RadDragAndDropManager.AddDropInfoHandler (this.scheduler, new EventHandler<DragDropEventArgs> ( this.OnDropInfo ) );
 RadDragAndDropManager.AddDropQueryHandler ( this.scheduler, new EventHandler<DragDropQueryEventArgs> ( this.OnDropQuery ) );
like I did with RadScheduler.

Thanks in advance

Thomas

22 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 25 Apr 2011, 07:53 AM
Hi Thomas,

How to drag and drop items to RadScheduleView you can see in our online example here.

Also, to implement the task I suggest you create a custom DragDropBehavior and override its ValidateExternalDrag method.This method should be used to convert dragged data to appointments.

For more details you can read our online documentation.

Regards,
Rosi
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Thomas
Top achievements
Rank 1
answered on 03 May 2011, 02:32 PM
Hi,

the CustomDragDropBehavior works fine when dragging Appointments within RadScheduleView, but it doesn't react if I drag my items from another control (ListBox; not in the same xaml file). ValidateExternalDrag is stated to be obsolete (says my VS)?! 
DropInfo is fired when I touch the border of my RadScheduleView, but not when I hover over the Slots so I can't get the Slot I am hovering over.

Where in the online example are the DropQuery/DropInfo handlers added? There are only handlers for the ListBox Drag & Drop defined, but not for RadScheduleView.

If I override 
GetDragDropStateForExternalDrag ( object payload, IDataObject dragDataObject, System.Collections.IEnumerable destinationAppointmentsSource )
payload and destinationAppointmentsSource is correctly set but the IDataObject is null. Is this correct?
Neither CanDrop nor DropQuery/DropInfo is executed/fired.

Don't know if it makes a difference, but the ScheduleView and the ListBox are in seperate TileViewItems and there within a RadFluentContentControl. The curious thing is if I try to handle the DropInfo Event, it fires if I touch the border, but not if I hover over the Slots or the Navigation Buttons. Also the DropQuery Event is never fired.

Working with the latest Dev.Build, tried it with the stable before, same results.

Regards,
Thomas
0
Rosi
Telerik team
answered on 11 May 2011, 08:26 AM
Hi Thomas,

The method that you can override instead of ValidateExternalDrag is called GetDraggedAppointmentsForExternalDrag.

Also, the example do not contains code for hooking to the DropQuery/DropInfo events to RadScheduleView as these events are hooked to the control internally. That is why I suggest you using a custom DragDropBehavior class instead of events when you need to modify the drag and drop logic of RadScheduleView.

Regards,
Rosi
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stephen
Top achievements
Rank 2
answered on 17 May 2011, 07:39 AM
I'm getting the exact same issues here. 

I'm trying to drag and drop from a Listbox with items that may or may not contain IAppointments, and want to add them (but not remove them from the ListBox). 

I'm using the normal RadDragAndDropManager examples but it seems the RadScheduleView does this internally now, so I'll need to somehow customise the drag and drop behaviour as you have suggested. 

An example of Drag and drop without using a ListBoxBehaviour would be great. ie A Customised DefaultDragAndDropBehaviour that accepts externally dropped items. 

thanks,
Stephen
0
Yana
Telerik team
answered on 20 May 2011, 09:28 AM
Hello Stephen,

I've attached the needed example, please download it and give it a try.
Hope it helps.

Regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stephen
Top achievements
Rank 2
answered on 20 May 2011, 09:56 AM
That code was useful, thanks. Helped me refactor the version I had (which was taken from the real version with a few lines commented out)

I do need to somehow convert my CalendarEvent (inherits from AppointmentBase) into an Appointment, as the type of the collection is ObservableCollection<Appointment>.

Would maybe be easier if the type was ObservableCollection<IAppointment> then I could just pass in mine which implements IAppointment.

thanks,
Stephen
0
Yana
Telerik team
answered on 24 May 2011, 12:34 PM
Hello Stephen,

I wasn't able to understand exactly the needed approach, could you please explain in more details? Thanks in advance

Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stephen
Top achievements
Rank 2
answered on 24 May 2011, 01:40 PM
I basically need to know how (or where) in the custom drag and drop manager you put the code to convert objects into IAppointments (assuming the payload is not an IAppointment).

Hope that's clearer. Sorry about that.
Cheers,
Stephen
0
Yana
Telerik team
answered on 25 May 2011, 04:25 PM
Hello Stephen,

I'm sorry I missed that requirement.  

You should override GetDragDropStateForExternalDrag and GetDraggedAppointmentsForExternalDrag methods in the custom DragAndDropBehavior in order to convert the listbox items to appointments.
I've modified the project to demonstrate the approach.

Hope this helps.

Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ken
Top achievements
Rank 1
answered on 26 Jul 2011, 01:56 PM
Hi,

I've a related question: is it possible to use a TreeViewDragCue when dragging from another type of source (e.g. RadGridView) to a RadScheduleView? More specifically, I don't know how to get the TreeViewDragCue during a drag operation and tell it the drop is possible, so it changes its visual indicator to the "drop allowed" one.

I currently have the drag drop working, using a custom ScheduleViewDragDropBehavior, but can find no point where to get the actual drag cue.

Any ideas?

Thanks!
0
Ken
Top achievements
Rank 1
answered on 26 Jul 2011, 04:31 PM
And another one: how can I know when the drop is complete on the scheduleview so that I remove the item from the source gridview's itemssource? I tried subscribing to the DragInfo event on the RadGridView, but while I get events with status DragInProgress, I never get events such as DragComplete or DropComplete. I suppose the ScheduleView is eating them up. What can I do in this case?

Thanks!
0
Yana
Telerik team
answered on 27 Jul 2011, 02:34 PM
Hello Adrian,

I guess that you're using Q2 release, right?  Can you send us more information about your exact scenario? Thanks in advance

Best wishes,
Yana
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
Ken
Top achievements
Rank 1
answered on 27 Jul 2011, 02:39 PM
Hi Yana,

Yes, I'm using the q2 release. Actually the "remove from source" part I already fixed. The remaining question is the one regarding the TreeViewDragQueue.

My scenario is this: I have a RadGridView from which I want to drag items to a RadScheduleView. Drag&Drop works fine. As the DragCue I'd like to use the TreeViewDragCue as it already has the nice "can be dropped here" indicator. However, I can't find a way to get to the DragCue when the drag cursor is over the RadScheduleView so I can set its drop possible property.

I tried to get at it somehow from my custom ScheduleViewDragDropBehavior, but can't. I also tried to subscribe to RadDragDropManager  events on the RadScheduleView but the handlers are never called. Subscribing to DragDropManager events works, but there I have no way to get the DragCue of the drag operation. Or I don't know how :)

If you need more info please ask specifically and I'll be happy to answer.

Thanks,
Adrian
0
BKR AG
Top achievements
Rank 1
answered on 28 Jul 2011, 08:42 AM
Hi,

I think there might be a bug in the current Q2 2011 release regarding the TreeViewDragCue.
I had it working before Q2. Now, after the update, the businesslogic still works but the visual drag cue does not show a arrow cue and does not update the "dropPossibleIcon".

Roland
0
Yana
Telerik team
answered on 28 Jul 2011, 03:05 PM
Hello,

I've prepared a sample project to demonstrate how to implement DragCue when dragging from listbox to ScheduleView with the Q2 release (the approach is the same in case of RadGridView), please download the attachment and give it a try.

Hope it helps.

Best wishes,
Yana
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
Ken
Top achievements
Rank 1
answered on 28 Jul 2011, 03:32 PM
Hi,

Are you sure you uploaded the right file? Because I tried and:
1. Your CustomDragDropBehavior inherits from DefaultDragDropBehavior, which as far as I can tell, is gone in q2, it should be ScheduleViewDragDropBehavior instead.
2. I don't see any DragCue visually. And I don't see it being set up in code either.
3. To be extra clear: I need a way to use the TreeViewDragCue AND be able to set its IsDropPossible property. I currently HAVE the TreeViewDragCue working, but it always shows the "drop not possible" indicator.

Please let me know if this is not clear and what exactly is not clear :)

Thanks,
Adrian
0
BKR AG
Top achievements
Rank 1
answered on 29 Jul 2011, 06:58 AM
Same here...

Michael
0
Yana
Telerik team
answered on 29 Jul 2011, 08:08 AM
Hello,

I'm sorry I didn't explain the approach in more details.

The RadScheduleView uses its default DragDropBehavior in the project, there is no need to override it since  the payload is of type ScheduleViewDragDropPayload.

The DragCue is set in OnDragQuery event handler:

e.Options.DragCue = this.CreateDragVisual(appointments);

Unfortunately, you cannot use TreeViewDragCue with the new RadDragAndDropManager. The style and the template of the current DragCue are placed in App.xaml file, you can modify them without a problem. 

I've also attached a short video showing that the project works as expected at our side. Could you please check again? Thanks

Kind regards,
Yana
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
Ken
Top achievements
Rank 1
answered on 29 Jul 2011, 09:32 AM
Hi Yana,

Thanks a lot for your answer. Also I have to apologize, seems I downloaded before some other version somehow of your demo project. I just downloaded it again and it's different than before and works fine :)

Thanks again,
Adrian
0
Santor
Top achievements
Rank 1
answered on 29 Jul 2011, 04:40 PM
Hi,

I have looked at your examplecode and add some ResourceTypes to it. But when I now run the application and I drag an appointment from the listbox to the scheduleview I get an error: Element is already the child of another element.

What can I do to add ResourceTypes to the examplecode without getting the error?

Thx


0
Yana
Telerik team
answered on 02 Aug 2011, 02:28 PM
Hi Santor,

Which version of the controls exactly you're using? Can you try the attached to this post project with the latest internal build (2011.2.0801) ?

Best wishes,
Yana
the Telerik team

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

0
Santor
Top achievements
Rank 1
answered on 04 Aug 2011, 11:31 AM
Hi Yana,

I'm now using the latest internal build and the grouping and resources are working with drag and drop.

Thank you for our reply!
Tags
ScheduleView
Asked by
Thomas
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Thomas
Top achievements
Rank 1
Stephen
Top achievements
Rank 2
Yana
Telerik team
Ken
Top achievements
Rank 1
BKR AG
Top achievements
Rank 1
Santor
Top achievements
Rank 1
Share this question
or