With RadScheduleView we began pushing a new model for drag-drop implementations, the so called DragDropBehavior, which is trying to hide the underlying UI elements, events, etc. and let you only work with the dragged data. We believe that this new layer of abstraction greatly simplifies the drag-drop implementations as you don’t need to understand the control structure and drag-drop events. In addition, as you are working only with data, you could create very complex business logic inside this behavior that can be easily tested.
Since the ScheduleView <–> ListBox is one of the most common drag-drop scenarios, we created a simple attached behavior that does everything for you – copy, move, reorder items in a ListBox. In case you are dragging from other control, such as RadScheduleView, or from a different application, it will automatically insert the dragged items in the ListBox.
I would be glad to get your feedback!
UPDATE Q3 2011 (version 2011.3.1116)
The behaviors are almost official, we already have online help:
http://www.telerik.com/help/silverlight/dragdropmanager-behaviors-listboxandscheduleview.html
And an example:
http://demos.telerik.com/silverlight/#ScheduleView/DragDrop
And also attached is a simple application that demonstrates how to implement behaviors for RadTreeView and RadGridView.
Regards,
Valeri Hristov
Telerik
29 Answers, 1 is accepted
You are correct, the attached binaries are compiled against version 2011.2.801, hence they cannot work with other internal builds. I will upload new binaries once this week's internal build is online.
All the best,
Valeri Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
The drag-drop behaviors will be included in the Telerik.Windows.Controls.dll in the today's internal build, e.g. you will not have to reference Telerik.Windows.DragDrop.Extensions.dll if you are using internal build with version 2011.2.822 and newer.
Regards,
Valeri Hristov
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 >>
Regards,
Valeri Hristov
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 >>
It is working perfectly!
Using new drag-drop manager in example that you have attached, how can i create DragCue in a way that it would be right under mouse cursor?
When i'm creating drag cue using CreateVisualCue, it always appears at the top/left corner of the dragged item, instead of cursor location;
public override FrameworkElement CreateVisualCue(ListBoxDragDropState state)
{
ContentControl element = new ContentControl();
element.Content = state.DraggedItems.FirstOrDefault();
return element;
}
Currently the ListBoxDragDropBehavior does not support setting an offset between the top-left corner of the drag visual and the mouse pointer, and there is no workaround. Unfortunately it is too late for something to enter in the today's internal build, so the best we can do is to include the feature in the next week's internal build.
All the best,
Valeri Hristov
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 >>
Thank you very much for this interesting example.
One thing I noticed while using your code:
When I drag an item from a listbox to the scheduleview, the item is not deleted from the listbox.
This is only the case when I hold the SHIFT-key during dragging.
Any idea how I can delete the items from the listbox by default after dropping them on the scheduleview?
Everything works fine in the other way: when I drag an item from the scheduleview to the listbox, it is correctly deleted from the scheduleview.
Thank you very much in advance.
Kind regards,
Ronald
You need to subclass the ListBoxDragDropBehavior and override the IsMovingItems method like this:
protected virtual bool IsMovingItems(ListBoxDragDropState state)
{
return !state.IsSameControl || base.IsMovingItems(state);
}
Kind regards,
Valeri Hristov
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 >>
Thank you very much, it is working now.
Have a nice day !
Kind regards,
Ronald
as i posted in this thread, the guidelines seem to be unusable due to the protection level of some methods. Moreover, the documentation is not really usable in this form; there are plenty of conflicting informations between using a custom ScheduleViewDragDropBehavior, a custom DragDrop, etc...
Could you clarify how one is supposed to design drag and drop from a control to a scheduleview, with conversion (or not)? What classes must be used, etc...
The drag-drop behaviors are still experimental, hence they are not completely open. Currently, except the built-in ScheduleView behavior, you could only use the ListBoxDragDrop behavior. We are working on similar behavior for RadGridView and RadTreeView, that will appear in the upcoming internal builds. We are aiming to provide official state for the behaviors (extensible API, support for more Telerik controls, better documentation etc.) for Q3 2011 in mid November.
Best wishes,
Valeri Hristov
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 >>
Greetings,
Valeri Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I get this exception:
Message: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
at Telerik.Windows.Controls.CollectionExtensions.HaveSameElementsAsSet[T](IEnumerable`1 c1, IEnumerable`1 c2)
at Telerik.Windows.Controls.DragDropHelper.<GetHighlightSlotsForDrop>d__d.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Telerik.Windows.Controls.DragDropHelper.GetDestinationSlotsForDrop(DragDropState state, IEnumerable`1 sourceResources, Point relativeDestinationPoint, TimeSpan offsetFromAppointment)
at Telerik.Windows.Controls.DragDropHelper.GetDestinationSlots(DragDropState state, Point& relativeDestinationPoint, IPayload payload)
at Telerik.Windows.Controls.DragDropHelper.GetDestinationSlots(DragDropState state, Point relativeDestinationPoint, IPayload payload)
at Telerik.Windows.Controls.DragDropHelper.GetDestinationSlots(Object data, Point relativeDragPoint)
at Telerik.Windows.Controls.DragDropHelper.OnDragOver(Object sender, DragEventArgs e)
at Telerik.Windows.DragDrop.DragEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at Telerik.Windows.RadRoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at Telerik.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RadRoutedEventArgs routedEventArgs)
at Telerik.Windows.RouteItem.InvokeHandler(RadRoutedEventArgs routedEventArgs)
at Telerik.Windows.EventRoute.InvokeHandlersImpl(Object source, RadRoutedEventArgs args, Boolean raisedAgain)
at Telerik.Windows.EventRoute.InvokeHandlers(Object source, RadRoutedEventArgs args)
at Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
at Telerik.Windows.DependencyObjectExtensions.RaiseEvent(DependencyObject element, RadRoutedEventArgs e)
at Telerik.Windows.DragDrop.DragOperation.RaiseDragEvent(RoutedEvent dragEvent, DependencyObject target)
at Telerik.Windows.DragDrop.DragOperation.OnDragOver(DependencyObject sender)
at Telerik.Windows.DragDrop.DragOperation.DoDragOver(DependencyObject currentTarget)
at Telerik.Windows.DragDrop.DragOperation.DragSourcetPreviewMouseMove(Object sender, MouseEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
I am unable to debug where this is happening. I had to update the Telerik controls to fix another bug and now my Scheduler doesn't work! please help.
UPDATE: Upgrading the Telerik Controls seems to have broken all of the gridviews in our project - the databindings are not working and all the grids are now blank.
I've just answered to the support ticket regarding this issue - we've tried to reproduce it but without much success. Can you send us more details which will help us observe the problem? Thanks
Greetings,
Yana
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
is the example for the drag&drop between the gridview and scheduleview available already?
It is of interest to us as we would like to implement this in our solution for a customer.
thanks
Ronald
Thanks
Ronald
The drag-drop behavior is still experimental, hence it is not mentioned in our online documentation. When it is ready, we will add several articles. In the meantime, you could read the MS Word document (in the attached to my first post ZIP file) that contains information how to use the behavior.
All the best,
Valeri Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
thanks for your feedback. I have already used your document and successfully implemented drag&drop between a listbox and RadScheduleView but since you stated in another thread that drag&drop between RadGridview and RadScheduleview is not possible yet untill the 2011 Q3 release I wanted to check if it is possible with the current internal build before I started trying.
thanks
Ronald
Kind regards,
Valeri Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
im using the Version 2011.2.920.1040 of your tools,could you provide an example wich shows
how to use a custom DragDropHelper and dragdrop behavior for drag and drop
funtionality between RadRibbonButton from the Ribbonview and the ScheduleView?
regards
Currently we support only the standard ListBox control and RadTreeView, RadGridView and RadScheduleView. We didn't tested with other controls and we cannot guarantee that the drag-drop helper will work correctly.
Kind regards,
Valeri Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
UPDATE -- Nevermind, I just wanted to blank it out and I was able to do that by setting subject to " ". If subject is empty then the cue defaults to just the word "Appointment", which is what I wanted to get rid of.
You just need to remove the DataConverter from the ListBox ( DataConverterAppointments in the example )- it is responsible for converting appointments back into the objects used in the Listbox.
Kind regards,
Yana
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.