Draging a Appointment in Month View changes the Times to 00:00

4 posts, 1 answers
  1. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 04 Jan 2013 Link to this post

    Why would dragging an appointment in Month-View reset the times for the Appointment

    While dragging the appointment in the Week-view or the Day-view does not change the times 

    How would I resolve this?
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 09 Jan 2013 Link to this post

    Hello Denis,

    Thank you for contacting us.

    It appears that this is an issue in the dragging behavior of RadScheduler. The issue has been logged and we will address it in a next release. Here you can track the PITS item: http://www.telerik.com/support/pits.aspx#/public/winforms/13950. For the time being, you can modify this behavior by creating a custom AppointmentDraggingBehavior. Here is how this can be achieved:
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.radScheduler1.SchedulerElement.DragDropBehavior = new MyDraggingBehavior(this.radScheduler1.SchedulerElement);
        }
    }
     
    class MyDraggingBehavior : AppointmentDraggingBehavior
    {
        public MyDraggingBehavior(RadSchedulerElement element)
            : base(element) { }
     
        public override bool Move(DateTime newDate)
        {
            if (this.Scheduler.ActiveViewType == SchedulerViewType.Month)
            {
                newDate = newDate.Add(this.ActiveFeedback.AssociatedAppointment.Start.TimeOfDay);
            }
            return base.Move(newDate);
        }
    }

    Your Telerik points have been updated. Feel free to ask if you have any further questions.

    All the best,
    Ivan Todorov
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 09 Jan 2013 Link to this post

    Hi Ivan 

    Thanks for the workaround, I will give it a bash in VB.net 

    :)
  5. Answer
    Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 11 Jan 2013 Link to this post

    Hello Denis,

    Here is the same code in VB:
    Public Partial Class Form1
        Inherits Form
        Public Sub New()
            InitializeComponent()
            Me.radScheduler1.SchedulerElement.DragDropBehavior = New MyDraggingBehavior(Me.radScheduler1.SchedulerElement)
        End Sub
    End Class
     
    Class MyDraggingBehavior
        Inherits AppointmentDraggingBehavior
        Public Sub New(element As RadSchedulerElement)
            MyBase.New(element)
        End Sub
     
        Public Overrides Function Move(newDate As DateTime) As Boolean
            If Me.Scheduler.ActiveViewType = SchedulerViewType.Month Then
                newDate = newDate.Add(Me.ActiveFeedback.AssociatedAppointment.Start.TimeOfDay)
            End If
            Return MyBase.Move(newDate)
        End Function
    End Class

    In such cases you can use our online C#-to-VB converter located at http://converter.telerik.com/.

    If you have any future questions, do not hesitate to ask.

    Regards,
    Ivan Todorov
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Back to Top