I guys,
I need to react to Appointment changes in the scheduler. In order to do so, I subscribed to the CollectionChanged event declared by the Appointments collection in the scheduler :
I have no problem on Add and ItemChanged actions, but I can't find the Appointment object in the e.OldItems collection on Remove action. I just keep on getting a null reference exception :
Thank you for your help :)
I need to react to Appointment changes in the scheduler. In order to do so, I subscribed to the CollectionChanged event declared by the Appointments collection in the scheduler :
radScheduler1.Appointments.CollectionChanged +=
new
NotifyCollectionChangedEventHandler(Appointments_CollectionChanged);
I have no problem on Add and ItemChanged actions, but I can't find the Appointment object in the e.OldItems collection on Remove action. I just keep on getting a null reference exception :
public
event
ControlAddInEventHandler OnAppointmentsCollectionChanged;
void
Appointments_CollectionChanged(
object
sender, NotifyCollectionChangedEventArgs e)
{
try
{
if
(OnAppointmentsCollectionChanged !=
null
) {
switch
(e.Action) {
case
NotifyCollectionChangedAction.Add:
foreach
(Appointment ap
in
e.NewItems)
{
OnAppointmentsCollectionChanged(1, ap.Subject);
}
break
;
case
NotifyCollectionChangedAction.ItemChanged:
case
NotifyCollectionChangedAction.Remove:
foreach
(Appointment ap
in
e.OldItems)
{
OnAppointmentsCollectionChanged(2, ap.Subject);
}
break
;
default
:
break
;
}
}
}
catch
(Exception ex)
{
OnAppointmentsCollectionChanged(3, ex.Message);
}
}
Thank you for your help :)