New to Telerik UI for WinFormsStart a free 30-day trial

Using a Data Provider

Updated on May 7, 2026

RadScheduler uses the Provider Design Pattern to allow for easy integration into existing applications. This allows to connect to various data sources.

You can use one of the scheduler data source components supplied with RadScheduler or implement your own if you have more specific data binding needs. Each scheduler data source inherits from the SchedulerDataSource abstract class and contains two providers – one for the appointment data and one for the resource data. To bind RadScheduler to a provider, set its DataSource property to e specific scheduler data source.

Example

This example shows how to bind RadScheduler to a collection of custom objects that contain appointment data using the SchedulerBindingDataSource component. This data source component allows binding to a collection of objects and can be used to bind RadScheduler not only to a collection of business objects, but to a ADO.NET DataTable ot the results of a LINQ query. First we have code out custom class that will contain the appointment data:

Custom Appointment Class

C#
public class MyAppointment : INotifyPropertyChanged
{
    private DateTime start = DateTime.Now;
    private DateTime end = DateTime.Now;
    private string subject = string.Empty;
    private string description = string.Empty;
    private string location = string.Empty;
    private Guid id = Guid.NewGuid();

    public MyAppointment()
    {
    }

    public MyAppointment(DateTime start, DateTime end, string subject, string description, string location)
    {
        this.start = start;
        this.end = end;
        this.subject = subject;
        this.description = description;
        this.location = location;
    }

    public Guid Id
    {
        get
        {
            return this.id;
        }
        set
        {
            if (this.id != value)
            {
                this.id = value;
                this.OnPropertyChanged("Id");
            }
        }
    }

    public DateTime Start
    {
        get
        {
            return this.start;
        }
        set
        {
            if (this.start != value)
            {
                this.start = value;
                this.OnPropertyChanged("Start");
            }
        }
    }

    public DateTime End
    {
        get
        {
            return this.end;
        }
        set
        {
            if (this.end != value)
            {
                this.end = value;
                this.OnPropertyChanged("End");
            }
        }
    }

    public string Subject
    {
        get
        {
            return this.subject;
        }
        set
        {
            if (this.subject != value)
            {
                this.subject = value;
                this.OnPropertyChanged("Subject");
            }
        }
    }

    public string Description
    {
        get
        {
            return this.description;
        }
        set
        {
            if (this.description != value)
            {
                this.description = value;
                this.OnPropertyChanged("Description");
            }
        }
    }

    public string Location
    {
        get
        {
            return this.location;
        }
        set
        {
            if (this.location != value)
            {
                this.location = value;
                this.OnPropertyChanged("Location");
            }
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged(string propertyName)
    {
        if (this.PropertyChanged != null)
        {
            this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

We will use a list to store our appointment data. For the purpose of this example we will populate the appointments collection with some dummy data in the OnLoad override of our form:

Create Appointments

C#
private List<MyAppointment> appointments = new List<MyAppointment>();

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);

    DateTime baseDate = DateTime.Today;
    DateTime[] start = new DateTime[] { baseDate.AddHours(14.0), baseDate.AddDays(1.0).AddHours(9.0), baseDate.AddDays(2.0).AddHours(13.0) };
    DateTime[] end = new DateTime[] { baseDate.AddHours(16.0), baseDate.AddDays(1.0).AddHours(15.0), baseDate.AddDays(2.0).AddHours(17.0) };
    string[] summaries = new string[] { "Mr. Brown", "Mr. White", "Mrs. Green" };
    string[] descriptions = new string[] { "", "", "" };
    string[] locations = new string[] { "City", "Out of town", "Service Center" };


    MyAppointment appointment = null;
    for (int i = 0; i < summaries.Length; i++)
    {
        appointment = new MyAppointment(start[i], end[i], summaries[i],
            descriptions[i], locations[i]);
        this.appointments.Add(appointment);
    }
}

And finally we will bind our RadScheduler instance to tha collection in the Click event handler of a button:

C#
private void btnBind_Click(object sender, EventArgs e)
{
    SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource();

    AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo();
    appointmentMappingInfo.Start = "Start";
    appointmentMappingInfo.End = "End";
    appointmentMappingInfo.Summary = "Subject";
    appointmentMappingInfo.Description = "Description";
    appointmentMappingInfo.Location = "Location";
    appointmentMappingInfo.UniqueId = "Id";

    SchedulerMapping idMapping = appointmentMappingInfo.FindByDataSourceProperty("Id");
    idMapping.ConvertToDataSource = new ConvertCallback(this.ConvertIdToDataSource);
    idMapping.ConvertToScheduler = new ConvertCallback(this.ConvertIdToScheduler);

    dataSource.EventProvider.Mapping = appointmentMappingInfo;
    dataSource.EventProvider.DataSource = this.appointments;

    this.radScheduler1.DataSource = dataSource;
}

In the above code we create a SchedulerBindingDataSource component. Then create a AppointmentMappingInfo in order to “tell” the appointment provider how the properties of objects from the data source (in our case the appointments collection) corresponds to properties of the IEvent interface.

Note how the SchedulerMapping class which is responsible for mapping a single property from the data source to a scheduler property (in our case property from the IEvent interface) allows you to specify convert callback methods in order to convert values to and from the data source if needed.

Finally, we set the Mapping and DataSource properties of the EventProvider contained in the SchedulerBindingDataSource and set the data source to our RadScheduler instance and we are done.

See Also

In this article
ExampleSee Also
Not finding the help you need?
Contact Support