RadScheduler - DragDrop from RadNodeTree to create appointment issues

1 Answer 18 Views
Scheduler and Reminder Treeview
Sean
Top achievements
Rank 1
Sean asked on 18 Aug 2022, 05:40 PM | edited on 18 Aug 2022, 05:41 PM

Not sure where I can submit a bug report but to replicate...

Create nodes on a RadNodeTree.

DoDragDrop on the node that is drag through NodeDragStart

When Node is dropped onto Scheduler, create the appointment.

This causes the program to flicker a lot and multiple appointments are created.


    Private Sub MyNodeTree_DragStarted(sender As Object, e As RadTreeViewDragEventArgs) Handles MyNodeTree.DragStarted
        If e.Node.Level = 0 Then
            MyNodeTree.DoDragDrop(e.Node, DragDropEffects.All)
        Else
            Return
        End If
    End Sub

    Private Sub RadScheduler1_DragEnter(sender As Object, e As DragEventArgs) Handles RadScheduler1.DragEnter
        If e.Data.GetDataPresent(GetType(RadTreeNode)) = True Then
            e.Effect = DragDropEffects.All
        End If
    End Sub

    Private Sub RadScheduler1_DragDrop(sender As Object, e As DragEventArgs) Handles RadScheduler1.DragDrop
            Dim node As RadTreeNode = e.Data.GetData(GetType(RadTreeNode))
            Dim point As Point = Me.ScheduleCalendar.PointToClient(New Point(e.X, e.Y))
            Dim schedulerCell As SchedulerCellElement = SchedulerUIHelper.GetCellAtPoint(point, Me.ScheduleCalendar)
            If schedulerCell IsNot Nothing Then
                Dim dragObject As String = e.Data.GetDataPresent(GetType(String))
                If dragObject IsNot Nothing Then
                    ScheduleCalendar.Appointments.BeginUpdate()
                    Dim ap As New Appointment(schedulerCell.Date, TimeSpan.FromMinutes(1), node.Name, "")
                    ap.AllDay = True
                    ap.BackgroundId = node.Index + 1
                    Me.ScheduleCalendar.Appointments.Add(ap)
                    ScheduleCalendar.Appointments.EndUpdate()
                End If
            End If

    End Sub

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 19 Aug 2022, 01:24 PM

Hi Sean,

Thank you for the provided code snippet.

Upon checking the code snippet, the default Ole Drag Drop events are used. In this case, I could suggest using the DragDropService of the RadTreeView. On my side, I have a sample project which demonstrates how to drag-drop from RadTreeView to RadSyntaxEditor. I have extended this approach to show how to drag drop from RadTreeView to RadScheduler placed inside RadDock control.

I am also attaching the sample project for your convenience. I hope that this project will be helpful.

Regards,
Dinko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Scheduler and Reminder Treeview
Asked by
Sean
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or