Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Collapse]Scheduler
   [Expand]Product Information
   [Expand]Getting Started
   [Collapse]Fundamentals
    [Expand]Scheduler Elements
    [Expand]Scheduler Structure
    [Expand]Appointments
     Resources for Appointments
    [Expand]Views
    [Collapse]Data Binding
     [Expand]Data Sources
      FetchAppointments Event - Handling Large Datasets
    [Expand]Mappings
    [Expand]Supported Formats
    [Expand]Services
    [Expand]Time Zones
     Printing
    [Expand]Scheduler Reporting
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Data Binding

The Scheduler can work with data that is bound to an external data source (data-bound mode) or use the internal storage (unbound mode). Although the common scenarios use external databases, and so require the control to be bound to data, the unbound mode also has its own advantages.

Expanded Unbound mode

If you do not bind a data source to the SchedulerStorage component, it will maintain appointments and resources in its internal storage system, so you can simply drop the Scheduler control on a form and instantly get a fully functioning calendar.

Unbound mode is a quick and easy way to get started with the Scheduler control and explore its features or when you need to manually control or manage data. Note the following tips when using the Scheduler in Unbound mode:

  • The data entered into the scheduler are contained in a SchedulerStorage instance. When this object is disposed of (e.g., when the application closes), all data are lost.
  • You can combine data-aware and unbound modes. For instance, you can store resources in an external data table but use unbound mode for appointments.
  • Mappings are unnecessary.

You can add and remove objects in respective collections manually, and use built-in methods to save and load in XML format. The following table lists SchedulerStorage collections and respective methods.

Object

Notation to Access a Collection

Method to Load

Method to Save

Appointment SchedulerStorage.Appointments.Items AppointmentCollection.ReadXml AppointmentCollection.WriteXml
Resource SchedulerStorage.Resources.Items ResourceCollection.ReadXml ResourceCollection.WriteXml
Dependency (Gantt View only) SchedulerStorage.AppointmentDependencies.Items AppointmentDependencyCollection.ReadXml AppointmentDependencyCollection.WriteXml
Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E155.

Expanded Data-Bound Mode

In most instances, you will need to store your data in an external data source, such as a data table or custom record collection. In such cases, you should bind the scheduler to the required data source using the SchedulerStorage component (it is created automatically when you place the SchedulerControl on a form). This component allows you to specify the data source and define mappings, so that the scheduler knows which fields to use in order to obtain the start time, end time, appointment subject, location, etc. You don't necessarily have to define all the mappings exposed by the SchedulerStorage. If you don't intend to use all of the functionality offered by appointments, you can specify just a couple of required fields (the mappings for the Appointment.Start and the Appointment.End properties are mandatory).

You can define any number of custom fields and map them to the appointment's custom properties. The data obtained from custom fields can be used to change appointment information displayed in the view. Custom fields can be exposed to end-users using the custom appointment editing form.

To use the XtraScheduler in bound mode, specify data sources for appointments and resources via the PersistentObjectStorage<T>.DataSource property of the corresponding storage, accessible via SchedulerStorage.Appointments or SchedulerStorage.Resources, respectively.

Note that after each data source assignment the scheduler starts layout calculation asynchronously in several threads. It is recommended to enclose the data source assignments which follow each other in SchedulerStorageBase.BeginUpdate - SchedulerStorageBase.EndUpdate method pair.

The data source can be the DataSet or the System.ComponentModel.BindingList<T> class instance, or any object that provides the System.ComponentModel.IBindingList interface. You can use the System.Collections.ArrayList object, but in this case the SchedulerControl will be in read-only mode.

The System.Collections.ObjectModel.ObservableCollection`1[[]] can also be used as a data source. When you consider the type of items in this collection, make sure that the properties (to which the Scheduler fields are mapped) are of simple data types.

Appointment Labels and Statuses are not data-bound. They are stored in collections accessible using the AppointmentStorage.Labels and AppointmentStorage.Statuses properties. An individual label or status can be retrieved by its index or identifier (UserInterfaceObject.Id property). Collections are populated with default items when the scheduler storage is initialized.

The following topics regarding data binding are available.

  • Data Sources
  • This topic describes the structure of data sources for the Scheduler. Read it to learn about the requirements for the Microsoft SQL Server and Microsoft Access tables, how to create an Object data source for binding to the Scheduler, and review examples of code and scripts.
  • Mappings
  • This topic describes the mapping concept, and explains how to create mappings that are required for binding the Scheduler to a data source.
  • How to: Bind a Scheduler to a database
  • This topic describes, step-by-step, how to bind the XtraScheduler to a Microsoft SQL Server database at design time.
  • How to: Create a Gantt Chart Application
  • This topic describes, step-by-step, how to bind the XtraScheduler to an SQL Server database at design time with additional requirements for the Gantt view.
  • Mappings Wizards
  • This topic describes the mapping wizard. This design-time feature facilitates data field mapping, but can also be the source of bugs if auto-mapping is not used with caution.
  • FetchAppointments Event - Handling Large Datasets
  • This topic answers a common question: what to do if the application is fetching unnecessary data, increasing server workload, and degrading overall performance.

How would you rate this topic?​​​​​​​