This is a migrated thread and some comments may be shown as answers.

AppointmentResized event

11 Answers 154 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 05 Mar 2013, 04:47 PM
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.

11 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 08 Mar 2013, 10:13 AM
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.
0
Denis Cilliers
Top achievements
Rank 1
answered on 02 Apr 2013, 10:39 AM
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

0
John
Top achievements
Rank 1
answered on 02 Apr 2013, 11:23 AM
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.
0
Denis Cilliers
Top achievements
Rank 1
answered on 02 Apr 2013, 01:44 PM
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 

0
Stefan
Telerik team
answered on 05 Apr 2013, 06:36 AM
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.
0
Robert
Top achievements
Rank 1
answered on 23 Apr 2013, 09:14 PM
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
0
Peter
Telerik team
answered on 26 Apr 2013, 04:30 PM
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.
0
Vijay
Top achievements
Rank 1
answered on 17 Sep 2013, 06:56 PM
Deleting my earlier comments. I was able to get it work.
0
olivier pareige
Top achievements
Rank 1
answered on 03 Nov 2014, 12:42 PM
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
0
olivier pareige
Top achievements
Rank 1
answered on 03 Nov 2014, 12:42 PM
My version is Q3 2014
0
Stefan
Telerik team
answered on 04 Nov 2014, 09:12 AM
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.

 
Tags
Scheduler and Reminder
Asked by
John
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Denis Cilliers
Top achievements
Rank 1
John
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Peter
Telerik team
Vijay
Top achievements
Rank 1
olivier pareige
Top achievements
Rank 1
Share this question
or