Version

Binding to Data Using ScheduleListDataSource (XamScheduler)

Purpose

This topic explains how to bind the control to a data source using ScheduleListDataSource.

Required Background

Topic Purpose

This topic provides an overview of the XamScheduler control.

Overview

You can bind the XamScheduler control to a data source using its DataSource property. This property accepts objects of type ScheduleDataSource. An implementation of this abstract base class is the ScheduleListDataSource class.

Main Properties

The following table lists the main properties you can use to configure an instance of the ScheduleListDataSource:

Property Purpose

You can set this property to an object implementing the IEnumerable interface and provide a set of Appointments which are going to be used by the control.

Set this property to an object implementing the IEnumerable interface and provide a set of ScheduleResources which are going to be used by the control.

Note
Note

You can even use your own object types for both activities and resources but in this case you must define a property mappings. This procedure is described in the Using Custom Entity Types (XamScheduler) topic.

Code Example

The following code snippet demonstrates how to create a XamScheduler control in XAML and set its data source to an instance of ScheduleListDataSource. Also the ScheduleListDataSource's appointments and resources are bound to the Appointments and Resources fields respectively in the binding context.

In XAML:

<ig:XamScheduler>
    <ig:XamScheduler.DataSource>
        <ig:ScheduleListDataSource
            AppointmentItemsSource="{Binding Appointments}"
            ResourceItemsSource="{Binding Resources}" />
    </ig:XamScheduler.DataSource>
</ig:XamScheduler>

The following code snippet demonstrates how to create a ScheduleListDataSource with one appointment and set it on a XamScheduler control named "scheduler1":

In C#:

ObservableCollection<Appointment> appointments = new ObservableCollection<Appointment>();
appointments.Add(new Appointment()
{
    Start = DateTime.Now,
    End = DateTime.Now,
    Subject = "Daily Meeting 1",
    Location = "Conference Room #1",
    ResourceId = "ID1",
});

ScheduleListDataSource listDataSource = new ScheduleListDataSource();
listDataSource.AppointmentItemsSource = appointments;

this.scheduler1.DataSource = listDataSource;

Related Topics

Topic Purpose

This topic explains how to bind the control to a data source which uses custom entity types.

This topic explains the Appointment activity type.

This topic provides information about the resources concept of the XamScheduler control.