What event is triggered when appointment is moved

6 posts, 0 answers
  1. Karel
    Karel avatar
    4 posts
    Member since:
    Jul 2012

    Posted 17 Jul 2012 Link to this post

    I use scheduler to show appointments. The scheduler is not mapped directly to some db table, so I have to handle persistence by myself. For adding and editing appointment I use CollectionChanged event of Appointments and it seems to work, however when the appointment is moved by dragging, the CollectionChanged  event is fired with Action NotifyCollectionChangedAction.Batch and I don't know what appointment was changed. Can anybody give me a hint how to handle this situation?

    Thank you
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 19 Jul 2012 Link to this post

    Hi Karel,

    Thank you for your question.

    You can use the AppointmentMoved, AppointmentDropped and AppointmentResized events to track changes in an appointment caused by user interaction.

    I hope you find this useful. Do not hesitate to ask if you have any other questions.

    Kind regards,
    Ivan Todorov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Karel
    Karel avatar
    4 posts
    Member since:
    Jul 2012

    Posted 20 Jul 2012 Link to this post

    Thank you for your answer, but for some reason I don't see the events you are mentioning.

    I can see event like AppointmentDeleted or AppointmentSelected, but not AppointmentMove or AppointmentResize, isn't this strange?

  5. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 24 Jul 2012 Link to this post

    Hi Karel,

    Can you please confirm which version you are using. The events I have mentioned were introduced with Q2 2011 SP1 so if you are using an older version, this would explain why you are not able to see them.

    Looking forward to hearing from you.

    All the best,
    Ivan Todorov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  6. Karel
    Karel avatar
    4 posts
    Member since:
    Jul 2012

    Posted 26 Jul 2012 Link to this post

    Hi Ivan,

    thank you for your reply, we are using Q2 2011, not the SP1 version, so that might explains why I couldn't access the events you mentioned. Honestly it seems a little bit odd to me that in the previous version you didn't have those events as they seem logical to me. Anyway what could I use to achieve what I want without the those events?

    Thank you for your help
  7. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 30 Jul 2012 Link to this post

    Hello Karel,

    There is no easy way to achieve your requirements in the version you are using. Some of the events are available through the DragDropBehavior of RadSchedulerElement. However this behavior is occasionally reinitialized and you can lose your event handlers. Also, this behavior is not used when resource grouping is applied.

    A possible approach I can think of is to check whether the Batch update was caused by the DragDropBehavior. Here is how you should implement this:
    void Appointments_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
    {
        if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Batch)
        {
            if (this.radScheduler1.SchedulerElement.DragDropBehavior.IsDragging)
            {
                UpdateAppointment(this.radScheduler1.SchedulerElement.DragDropBehavior.ActiveFeedback.AssociatedAppointment);
            }
        }
    }

    In all other cases when you receive a Batch update, you should update all appointments to make sure that your database is consistent.

    I hope this will help. Feel free to ask if you have any additional questions.

    All the best,
    Ivan Todorov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready