Drag and drop multiple appointments

4 posts, 0 answers
  1. BALOGOUN
    BALOGOUN avatar
    2 posts
    Member since:
    Nov 2012

    Posted 17 Dec 2012 Link to this post

    Hello,

    I would like to drag and drop multiple appointment located in several different resources. The default behavior of scheduleView is that all appointments are dropped into the pointed resource row on mouse release. What I want is a slide up or down of each item selected, keeping them at the same distance from each other's at the mouse release. You will see what I really want on attached pictures.

    AB.

  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 19 Dec 2012 Link to this post

    Hello,

    What you need can be achieved with a custom DragDrop behavior for the ScheudleView control. The attached sample project demonstrates how a behavior similar to what you need can be achieved. Please notice that this approach have some limitations and works completely only in TimelineView and only with single resource per appointment.

    Hope this helps.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. BALOGOUN
    BALOGOUN avatar
    2 posts
    Member since:
    Nov 2012

    Posted 27 Dec 2012 Link to this post

    Hello,

    Thank you for your quick response and it responds perfectly to my problematic. I would also like to ask you how I can implement a custom visual cue drag when a set of appointment is dragged.

    Regards,
    AB.
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 02 Jan 2013 Link to this post

    Hello,

    You should customize the DragVisualTemplate property of the ScheduleView. 

    DragVisualTemplate property is of type DataTemplate and is used to define the content of the DragVisual.  It receives as DataContext a list of the dragged appointments (or occurrences in case of recurrent appointments).

    Here is the default DragVisualTemplate:

    <telerik:DraggedAppointmentsToLocalizedStringConverter x:Key="DraggedAppointmentsToLocalizedStringConverter" />
    <DataTemplate x:Key="DragVisualContentTemplate">
    <TextBlock Text="{Binding Converter={StaticResource DraggedAppointmentsToLocalizedStringConverter}}" TextWrapping="Wrap" MaxWidth="200"
                MaxHeight="66" TextTrimming="WordEllipsis" />
    </DataTemplate>

    Note the use of DraggedAppointmentsToLocalizedStringConverter – it is needed to cover  the cases when multiple appointments are dragged. You could change the template and the converter according to your needs. Then just set the newly created template to the DragVisualTemplate property of the ScheduleView:

    <telerik:RadScheduleView AppointmentsSource="{Binding Appointments}"
                DragVisualTemplate="{StaticResource DragVisualContentTemplate}">
        ...
    </telerik:RadScheduleView>

    Hope this helps. Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top