I use the Xamarin package and I've some problems using the SfSchedule control.
I use Galasoft MVVMLight, and mantains the data structure in a view model.
In particular, I've found this strange behaviors:
1)
I've created a subclass of ObservableCollection, that has a AddRange
method that add all emement of another enumerable type in my
ObservableCollection and raise the CollectionChanged event (with arguments
NotifyCollectionChangedAction.Reset) only when
I've added all the element. Using this method, the appointments
collection of SfScheduled is not updated (the control not show any
appointment).
The appointments are loaded correctly if I add the element using the ObservableCollection.Add method, but in this case I have a long overhead caused by the fact that the UI must respond to many CollectionChanged events, one after another.
2) In some particular circumstances, I need
to logout from app, change the webservice address used by the app, and
login again. In this situation I need to clean old data and reload a new
data stream. If I invoke RangeObservableCollection.RemoveAll() I receive the error below (I've tested only on Android by now)
----------
Start error log
----------
Error message -> "Handle must be valid. Parameter name: instance"
Source -> Java.Interop
---- Begin StackTrace ----
at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00017] in /Users/builder/data/lanes/4009/9578cdcd/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:11250
at Android.Runtime.JNIEnv.CallObjectMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x00000] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/JNIEnv.g.cs:96
at Com.Syncfusion.Schedule.SfSchedule.get_Appointments () [0x00043] in <2d3464433f994e02b4d3970e6553e4a5>:0
at Syncfusion.SfSchedule.XForms.Droid.SfScheduleMapping.CustomAppointmentCollection_CollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <a2812d3ca40446b082e3eda1c7702d3d>:0
at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00012] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:288
at RangeObservableCollection`1[T].RemoveAll () [0x0002b] in RangeObservableCollection.cs:49
at AppointmentService.Clear () [0x0000e] in AppointmentService.cs:155
---- End StackTrace ----
----------
End error log
----------
where RangeObservableCollection is my custom ObservableCollection, and
the RemoveAll method remove all element from the collection and, at the
end, raise a CollectionChanged event with arguments
NotifyCollectionChangedAction.Reset.
I've tryed also to call ObservableCollection.Clear() but the result is the same
At the moment I've solved recreating a new RangeObservableCollection in AppointmentService.Clear()
I hope I was be clear.
Best regards and good job
Gabriele Benvenuti