silverlightmvvmtelerikobservablecollectiontelerik-scheduler

Telerik ScheduleView Appointments CollectionChanged fires with empty object


i am handling CollectionChanged on Appointments ObservableCollection on my ViewModel to catch newly added appointments and any changes in appointments in the UI. but i found that CollectionChanged event fires just when user double click the ScheduleView and Add new appointment window appears (but before entering any info.) so in CollectionChanged handler I got empty appointment object .

any ideas please ??


Solution

  • ObservableCollection implements INotifyCollectionChanged interface which is supposed to notify you when the collection changes and not when an item's property changes in the collection.

    I never used Telerik's ScheduleView, but I guess 'when you add a new appointment' you get the correct object in the event. So, you have a reference to the new appointment object, it is just empty. Because it is supposed to be empty (nothing entered in the UI yet, nothing written back to the object).

    But because you have the reference to the same object when Telerik's control updates that appointment object then your object will be the same (with the correct information).

    Probably there is another Telerik event or command for saving this appointment, but you should be okay with the received one, because I'm sure telerik will use that object to 'fill out' the appointment.