AppointmentResized event

12 posts, 1 answers
  1. John
    John avatar
    60 posts
    Member since:
    Nov 2006

    Posted 05 Mar 2013 Link to this post

    is there a better event to use than AppointmentResized for resize appointment changes?  this even seems to fire every block the resize hits instead of once when the user finishes resizing the control.  I need to save off the new time for the appointment when they get done resizing.  saving it 5 times as they drag it bigger isn't good.

    Thanks.
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 08 Mar 2013 Link to this post

    Hello John,

    Thank you for writing.

    This is how the resizing/ed events are designed to work. For your case, you can capture the changes in the CollectionChanged event of the Appointments collection.

    I hope that you find this information useful.

    Greetings,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 02 Apr 2013 Link to this post

    Hi John 

    I have the same requirement, how would this be done using the Collection Changed event (VB.net pls)
    As this event fires on every change so catching just the Re-size events this way seems like using a canon to shoot a pigeon

    Also what then is the point of the re-size events if these event fires after each scheduler block is closed, making it only useful when that one condition is met and useless when the user needs to re-size more than one block 

    One Issue I noticed is that due to using a different event we would loose the e.Appointment and thus the details of the re-size

    Private Sub rsScheduler_AppointmentResized(sender As Object, e As AppointmentResizedEventArgs) Handles rsScheduler.AppointmentResized
     
           'Save the Appointment Times
           CurrentAppointment.Appointment_Start = e.Appointment.Start
           CurrentAppointment.Appointment_End = e.Appointment.End
     
           _SchedulerService.SaveAppointment(CurrentAppointment, CurrentUser)
     
    End Sub

  5. John
    John avatar
    60 posts
    Member since:
    Nov 2006

    Posted 02 Apr 2013 Link to this post

    i used 2 events to do what i needed.

    i used the usual scheduler appointment resizing event first.  i just saved off the appt that was resizing into a form level variable to use it later.

    then in the collectionchanged event, i filtered the events with an 

    if (e.Action == NotifyCollectionChangedAction.ItemChanged && e.PropertyName == "Duration")
    

    if it makes it into the if, it's being resized.  I checked my form level variable for null also, if it's null i didn't do anything, if it's not, i know i'm resizing something.  at the end of the method, i nulled out the form level variable.

    i agree with you about the cannon.  until telerik provides proper resizing started, resizing complete events that's the only way i could get it to work.

    I'm not sure how to do this if you don't want to know until multiple resizes are done.  I only cared about a single appt resize.
  6. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 02 Apr 2013 Link to this post

    Hi John 

    I also went with the two event idea 

    I also saved the resize details to a local property 

    I used a different check for the Collection changed event, but will look into the one you used

    Private Sub Appointments_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
     
           If e.ResetReason = CollectionResetReason.Refresh _
               AndAlso (e.Action = NotifyCollectionChangedAction.ItemChanged _
                        AndAlso e.PropertyName = "Duration") Then
     
               If ShowConfirmationMessage() Then
     
                   Dim changedAppointment As Telerik.WinControls.UI.Appointment
                   Dim list As SchedulerAppointmentCollection
     
                   list = DirectCast(sender, SchedulerAppointmentCollection)
     
                   changedAppointment = TryCast(list.Item(e.NewStartingIndex), Telerik.WinControls.UI.Appointment)
     
                   If changedAppointment.Start = CurrentAppointment.Appointment_Start andalso changedAppointment.End = CurrentAppointment.Appointment_End Then
                       _SchedulerService.SaveAppointment(CurrentAppointment, CurrentUser)
                   End If
     
               End If
     
           End If
       End Sub

    I agree that the second check for the Start and the End dates is a mute point, but I left it just as a sanity check for making sure that there is a change when saving 

    Thanks for the help it seems be working 

  7. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 05 Apr 2013 Link to this post

    Hello guys,

    Thank you for writing back.

    The Resizing/Resized event are designed to work like this, as it is common user requirement to restrict resizing in some cells. With the current event implementation, this is possible. 

    So to save an appointment changes, you can use the CollectionChanged event and check for "Duration" property change:
    void Appointments_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
    {
        if (e.PropertyName == "Duration")
        {
            Appointment resizedAppointment = e.NewItems[0] as Appointment;
            //save appointment changes
        }
    }

    Private Sub Appointments_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
        If e.PropertyName = "Duration" Then
               Dim resizedAppointment As Appointment = TryCast(e.NewItems(0), Appointment)
            'save appointment changes
        End If
    End Sub

    I hope this helps.
     

    Kind regards,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  8. Robert
    Robert avatar
    15 posts
    Member since:
    Aug 2011

    Posted 23 Apr 2013 Link to this post

    Hi Stefan,
    but Appointments_CollectionChanged with Duration checking is called on resizing over every cell when left mouse button is still pressed.

    I need to confirm the resize when is finished (after left mouse button up action).
    How can I do that?

    Thank you
    Robert
  9. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 26 Apr 2013 Link to this post

    Hello Robert,

    Thank you for writing.

    I was not able to reproduce this behavior using our latest version and 2013.1 220 version - please, refer to the attached video from the my attempts. Could you please send us an application where this can be reproduced? Please note that you have to open a new support ticket in order to be able to attach files. 

    Thank you for your cooperation. I am looking forward to your reply.

    Kind regards,
    Peter
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  10. Vijay
    Vijay avatar
    4 posts
    Member since:
    Sep 2013

    Posted 17 Sep 2013 Link to this post

    Deleting my earlier comments. I was able to get it work.
  11. olivier pareige
    olivier pareige avatar
    6 posts
    Member since:
    Aug 2012

    Posted 03 Nov 2014 in reply to Peter Link to this post

    Hi Peter,

    I confirm what Robert said.
    Appointments_CollectionChanged with Duration checking is called on resizing over every cell when left mouse button is still pressed.

    But, I need to confirm the resize when is finished too.

    Thank you
  12. olivier pareige
    olivier pareige avatar
    6 posts
    Member since:
    Aug 2012

    Posted 03 Nov 2014 in reply to olivier pareige Link to this post

    My version is Q3 2014
  13. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 04 Nov 2014 Link to this post

    Hello Oliver,

    In the latest version you can use the AppointmentResizeEnd event to capture when resizing of appointment has ended.

    I hope this helps.

    Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for WinForms is Visual Studio 2017 Ready