How to: Bind a Scheduler Storage to a RangeControl

  • 5 minutes to read

This example demonstrates how to bind the SchedulerStorage to RangeControl so that the appointment data held within the scheduler storage is rendered in the RangeControl's viewport. The GridControl control is used to show detailed information on appointments (appointment's subject, start time, end time and description) that belong to the time interval that is currently selected in the RangeControl.

  1. Create an instance of the SchedulerStorageRangeControlClient class with the specified SchedulerStorage object. This class implements the IRangeControlClient interface and allows you to create a Range Control Client that will visualize the appointment data contained within the specified SchedulerDataStorage in the RangeControl viewport.
  2. Assign the created SchedulerStorageRangeControlClient object to the RangeControl.Client property to bind the SchedulerStorage to the RangeContorl.
  3. Use the RangeControl.SelectedRange property to set the time range that will be initially selected in the RangeControl after an application has been invoked.
  4. Subscribe to RangeControl.RangeChanged event. In this event handler, call the SchedulerStorageBase.GetAppointments method to retrieve a collection of appointments contained within the time interval that is currently selected in the RangeControl and assign this collection to the GridControl.DataSource property to display corresponding appointments in the Grid Control.
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace SchedulerStorageRangeControl {
    static class Program {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() {
            //DevExpress.UserSkins.BonusSkins.Register();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

The image below shows the result.

SchedulerStorage_RangeControl_Example_Result

See Also