Data Binding
- 3 minutes to read
The scheduler operates with appointments and resources. These objects may persist if the scheduler is bound to data. The scheduler can operate in bound and unbound mode.
Unbound Mode
If you do not bind a data source to the SchedulerControl component, it maintains appointments and resources internally, so you can just drop the SchedulerControl on a form and instantly get a fully functioning scheduling application.
You can add labels, statuses and resources in XAML or code-behind, and load appointments in code by instantiating the AppointmentItem objects and adding them to the SchedulerControl.AppointmentItems collection.
To manage Scheduler items in code, access the corresponding collections using the properties listed in the following table:
Item | Property |
---|---|
Appointment | SchedulerControl.AppointmentItems |
Resource | SchedulerControl.ResourceItems |
Label | SchedulerControl.LabelItems |
Status | SchedulerControl.StatusItems |
Bound Mode
Data-bound mode requires bindings to external data sources for appointments and resources and mappings which map data fields to appointment and resource properties. Mappings are different if an appointment have a single associated resource or several resources (shared resources).
Review the First Lesson - Create a Simple Scheduling Application topic for a simple example of the data-bound scheduler.
Important
Each binding requires a corresponding mapping to work.
Tip
You can operate in a mixed mode, with appointments contained in the external data source or MVVM data model and bound to the DataSource.AppointmentsSource property, and labels, statuses or resources created in code or XAML added to the respective collections.
The following table lists properties specific to data binding:
Member | Description |
---|---|
DataSource | An object that specifies data sources and mappings for the Scheduler objects. |
DataSource.AppointmentsSource | Gets or sets a collection of objects containing appointment information. This is a dependency property. |
DataSource.ResourcesSource | Gets or sets a collection of objects containing resource information. This is a dependency property. |
DataSource.AppointmentLabelsSource | Gets or sets a collection of objects containing appointment label (category) information. This is a dependency property. |
DataSource.AppointmentStatusesSource | Gets or sets a collection of objects containing appointment status information. This is a dependency property. |
AppointmentMappings | Provides information on the appointment properties’ mapping to data fields. |
ResourceMappings | Provides information on the resource properties’ mapping to data fields. |
AppointmentLabelMappings | Provides information on the appointment label properties’ mapping to data fields. |
AppointmentStatusMappings | Provides information on the appointment status properties’ mapping to data fields. |
CustomFieldMapping | Provides information on custom property mapping to appropriate data fields. |
SchedulerControl.AppointmentsUpdated | Occurs after Scheduler appointments are updated. |
DataSource.ResourceSharing | Gets or sets a value indicating whether an appointment can be shared between multiple resources. This is a dependency property. |
AppointmentResourceIdCollectionXmlPersistenceHelper | Provides methods to load resource ID’s from XML and export them in the same format they are stored in the bound data source. |