Hello there,
We already manage drag and drop operations fine to a RadScheduleView target in an empty slot or on an existing Appointment. However we need to manage a drop event on a given resource on the left-hand side of the Schedule-View (resources displayed vertically here). I mean in this case, we do not drop on a time slot, but on a resource header.
Just to make it clear : if a drop occurs on a given slot, we can already create an appointment for that slot. Now we would like to provide an action "Create Appointment for that resource and find our the time slot automatically based on some business logic". You see?
So far, it seems the DragDropBehavior.CanDrop() method is not involved when we drag over the resource header on the left side of the ScheduleView.
Thanks
/Sébastien Lacroix
6 Answers, 1 is accepted
hmmm, after sending, I realize I should probably define some dragDrop behavoResource Header I am talking about, in the VerticalResourceTemplate. For now we handle it with a simple TextBlock. I just tried to set the AllowDrop attribute without success. Any suggestion would be greatly appreciated.
<selectors:OrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate>
<DataTemplate>
<Border Height="{Binding DataContext.Preferences.HorizontalBarresHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PlanningView}}}"
Width="150">
<StackPanel Margin="1">
<TextBlock FontSize="12"
AllowDrop="true"
Foreground="Black"
Margin="0"
Text="{Binding Name.DisplayName}"
TextWrapping="Wrap"
VerticalAlignment="Center"/>
In order to achieve the desired you need to modify the default DragDrop behavior of RadScheduleView and have a UI element inside the GroupHeader inside which you will drop the appointment.
We suggest you to check the following sample project from our SDK Repository that demonstrates how to implement such custom behavior:
https://github.com/telerik/xaml-sdk/tree/master/ScheduleView/CustomDragDropBehavior
You could use it as a start point for your scenario. Basically, the approach is the same however, instead of dropping inside ListBox you need to implement your logic for dropping inside the GroupHeader.
Hope this helps.
Regards,
Nasko
Telerik
We've left this issue unsolved for a long time. There was probably a misunderstanding at the very beginning: the "Resource GroupHeader" we want as drop target is the GroupHeader Label Text box itself like the grey "Room 1" in the mentioned example. (see attached picture). It is not the range of time slot below Room1.
We've tried to use the custom DragDropBehavior for this case without success. The CanDrop method never fires when you move over the wanted target "Room <X>" like if the group header label was not controlled by the scheduleView drag drop behavior.
Are we dealing with a limitation of the DragDropBehavior?
/Sébastien
We have created a sample project that demonstrates the described in my initial response approach.
Basically, inside the GroupHeader using GroupHeaderContentTemplateSelector we created a Template that contains TextBlock with AllowDrop property set to True. After that using the DragDropManager we implemented a DragDrop functionality for that TextBlock to allow dropping appointments on it.
Please, check the example - when you drop an item from the DataGrid placed on the left side of RadScheduleView into the GroupHeader the AppointmentsDialog gets visualized and an appointment could be created.
We hope this will help you.
Regards,
Nasko
Telerik by Progress
Hello Nasko, thank you very much for your sample. We are currently implementing it in our app and this looks very promising.
Best regards
/S
I am glad to here the provided sample was helpful for you. Please, take as much as time as you need to implement the proposed solution in you application. Meanwhile, if you have any additional questions or concerns regarding the proposed approach or for some of our other controls, please do not hesitate to contact us.
Regards,
Nasko
Telerik by Progress