Hi,
I am implementing drag/drop behaviour from a simple ListView of appointment objects to an UltraDayView control (v8.3).
What I would like to do is copy the visual bahaviour of the day view that you get when you drag an appointment from one place to another, i.e. when the mouse enters the DayView on a drag operation, an AppointmentUIElement would 'appear' and follow the mouse until it is dropped.
I've been playing with creation/draw filters to try and make this work, without any success; can anyone advise if this would even be possible and if so, maybe point me in the right direction?
Thanks, Jim.
OK, I have got this working again and this time I understand what is going on!
The business objective is to take appointments that already have start and end times defined, but no owner, and assign them to an available resource.
Firstly, I am setting the UltraCalendarInfo datasource to be a collection of custom appointment objects, bound through the DataBindingsForAppointments and set to be owned by the built in 'unassigned' owner which is set to never be visible. All appointments already assigned to an owner are added to the datasource as and when required.
When the user starts a drag/drop operation from the ListView I am locating the appropriate Appointment object that is bound to the UltraCalendarInfo and setting this as the data object for the DoDragDrop method.
As the user drags the object over the UltraDayView I am updating the appointment, as exposed through the DragEventArgs, in the DragOver event, by setting the Owner, Start and End times; these are obtained using the GetOwnerFromPoint, GetTimeSlotFromPoint and GetVisibleDayFromPoint methods on the UltraDayView.
Implementing this in the DragOver event is the key - without it, it does not work.
If the user drags the appointment off the control without dropping it I am simply resetting the owner as unassigned and hiding the appointment.
It works!
Thanks for the feedback, Jim.
Hi Danko,
I found that simply setting the appointments visible property to false gave me all I needed on DragLeave, although then I was having to keep a local reference to the appointment object being dragged rather than obtaining it through the DragEventArgs as these do no exist for the DragLeave event.
However, the drag behaviour I was seeking now no longer occurs! I am not sure what I have changed to stop it, but if I work it out I will let you know!
Cheers, Jim.
Hello Jim,
Have you been able to try the Brian's suggestion?
Please let us know if you have any further questions.
DayView does not provide external drag/drop functionality out of the box, so I am not sure how you got this to happen. Assuming you add an Appointment to the UltraCalendarInfo.Appointments collection in the DragEnter event, you could use the converse of that approach and remove it in DragLeave.
Happys Days!
Looks like the day view provides this behaviour out of the box - I've corrected logic elseweher in my code and this is now working as required.
One thing though - if I drag the ListView object back out of the DayView control bounds (having not 'dropped' it), the appointment is left showing in the last position it was dragged to. How can I force the DayView to cancel this uncommited change and re-paint the screen?
Jim.