Version

ScheduleListDataSource Class

ScheduleDataSource-derived class for use with lists of objects that provide data from which appointments and resources can be created.
Syntax
public class ScheduleListDataSource : ScheduleDataSource, Xamarin.Forms.IElementController  
Remarks

The ScheduleListDataSource class provides the ability to bind a list of "plain old CLR objects" (commonly referred to as a "POCOs"), which provide Infragistics.Scheduler.Appointment and Infragistics.Scheduler.ScheduleResource data. An existing class can be used to represent an appointment or a resource, provided that the class exposes properties of the required type. If the names of these properties are the same as the corresponding appointment/resource property, these properties are automatically bound to their respective appointment/resource properties; if the names are different, property mapping support is provided through the AppointmentPropertyMappings and ResourcePropertyMappings collections.

The AppointmentItemsSource property accepts any value which implements the IEnumerable interface. However, with a simple IEnumerable implementation, certain functionality is not supported, most notably creation of new appointments, and deletion of existing ones. External modifications to the item source are not reflected by the ScheduleListDataSource class, since the IEnumerable interface does not provide any change notification mechanism.

With an item source which implements the IList interface, creation and deletion of appointments through the ScheduleListDataSource API is supported, but external changes to the item source are, as with an IEnumerable implementation, not reflected by the ScheduleListDataSource, again due to the lack of a change notification mechanism. Note that the List<T> class falls into this category as well.

An item source which implements the IList and INotifyCollectionChanged interfaces provides the most functionality, as content change methods as well as notification methods exist. In this case, creation and deletion is supported both through the ScheduleListDataSource API and via external changes to the collection. When possible, it is best to use the ObservableCollection<T> class, which supports both content change and notification mechanisms.

Another requirement for the ability to create new appointments is a public parameterless constructor exposed by the underlying data object class. If the class does not expose a public parameterless constructor, the CreateAppointmentDataObjectCallback property can be used to provide a factory method which is called when a new Appointment object is created. Without a parameterless constructor or a factory method, addition of new appointments is not supported, regardless of whether the item source supports content changes.

The ResourceItemsSource property works the same as AppointmentItemsSource, although because adding/removing resources is not supported through the user interface, it is not as important to use a list type which supports creation and deletion.

Note that the "POCO" object which provides the backing store for an appointment or resource must implement the INotifyPropertyChanged interface in order to support external changes made to that object. Without such a property change notification mechanism, ScheduleListDataSource cannot react to changes made to property values, and as such will not be able to keep the corresponding properties of the appointment or resource object synchronized. Changes made to property values of the Appointment and ScheduleResource class through the API, however, are immediately reflected by ScheduleListDataSource, and are immediately propagated back to the underlying data object as well.

The following table summarizes the functionality which is available under each usage scenario:

Interface(s) Functionality
IEnumerable Provides only basic functionality. An appointment/resource is created for each item in the list, but adding new items and removing existing ones is not supported.
IList Provides the ability to add/remove appointments/resources, but only through the API.
INotifyCollectionChanged Provides the ability to add/remove appointments/resources through external changes made to the item source.
IList + INotifyCollectionChanged Addition and removal of appointments/resources is supported both through the API as well as external changes made to the item source. For best results, the ObservableCollection<T> class is recommended as this class implements both interfaces.
INotifyPropertyChanged If implemented on the underlying data object class (i.e., "POCO"), external changes made to properties of the object are immediately synchronized with the corresponding appointment/resource object. Note that changes made through appointment/resource properties are always propagated back to the underlying data object, so an INotifyPropertyChanged implementation is unnecessary in that scenario.

Requirements

Target Platforms: Android 4.4+, iOS 8+

Development Environments: Visual Studio 2015+, Visual Studio for Mac Preview, Xamarin for Visual Studio 4.2+

See Also