[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]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Collapse]Scheduler
   [Expand]Product Information
    Getting Started
   [Expand]Scheduler Elements and Structure
   [Expand]Data Binding
   [Expand]Appointments
   [Expand]Views
   [Expand]Supported Formats
    Printing
   [Expand]Scheduler Reporting
   [Expand]Time Zones
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
   [Expand]Services
   [Expand]Member Tables
   [Expand]Visual Elements
   [Expand]Examples
  [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]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Getting Started

This article walks you through primary Scheduler features and concepts.

Expanded Create a Sample Application

  1. In Visual Studio, start a new WinForms project and drag the SchedulerControl from the Toolbox onto the form. Set the control's Dock property to Fill. You can also use the "Scheduling Application" template from the Template Gallery.

  2. You can access the Scheduler's main settings through the control's smart tag. For example, click the "Create Ribbon" link under the Command UI category, then select "Create All Bars". This generates a Ribbon populated with items that allow users to operate the Scheduler at runtime. You can manually customize this Ribbon as your needs dictate.

  3. End-users can perform the following actions when they run the sample application:

    • Use the buttons on the "View" Ribbon tab to change the currently active Scheduler View;
    • Zoom the Scheduler in or out using the mouse scroll wheel while holding down the Ctrl key;
    • Right-click the Scheduler's client area to invoke a context menu that allows you to create new appointments and events;
    • right-click the Scheduler Time Ruler or use commands from the Ribbon "View" tab to change the time interval (30 minutes by default);
    • print or export the calendar using the "File" Ribbon tab commands.

  4. Close the application and set up the following Scheduler properties.

    • Modify the SchedulerControl.ActiveViewType property to change the default Scheduler View.

    • Invoke the control's smart tag menu and uncheck Views that you wish to hide from end-users.

    • In the Visual Studio Property Grid, expand the SchedulerControl.Views section to access View settings. Every View has its own set of properties that you can change individually. For instance, change settings from the DayView's DayView.TimeRulers group to modify the Time Ruler element: increase or decrease the time interval, show minutes and/or time designators ("AM" and "PM" labels), display the current time marker, etc.

      Tip

      Note that there is no option that switches the Time Ruler between the 12-H and 24-H time formats. See the How to: Display TimeRulers with Different Time Formats Together article to learn how to do that.

    • The Scheduler provides multiple options to navigate through dates at runtime: scrolling, "Back" and "Forward" navigation buttons, and the "Go to Date..." item in the Scheduler's context menu. To provide a more convenient and intuitive date navigation option, locate the DateNavigator control on the Visual Studio toolbox and drop it into the form. Date Navigator is a calendar that automatically connects to the Scheduler via the DateNavigator.SchedulerControl property. If you select a date in Date Navigator, the Scheduler scrolls to that specific date. Users can also use marquee selection or hold down the Shift/Ctrl keys to select date ranges. The Scheduler automatically applies the View that fits the selected range.

      Tip

      Place Scheduler and DateNavigator controls into separate SplitContainerControl panels to resize both controls at runtime.

Expanded Binding to Data: Scheduler Storage & Appointments

When you add a Scheduler Control to a form, it automatically adds the associated SchedulerDataStorage component - an external storage that keeps all Scheduler data: appointments, resources, labels, etc. The storage is associated with the Scheduler control via the SchedulerControl.DataStorage property. You can manually add more storage to the form and use the control's smart tag to select the currently active one.

You can bind the storage to a data source that stores appointments - records that represent upcoming events or plans. For this example, you will need the sample "CarsDB.mdb" MS Access database. You can find this database in the demo source code folder (SchedulerDemos\Data).

  1. Invoke the Scheduler's smart tag menu, open the "Appointments Data Source" combo box, and click the "Add Project Data Source..." link.

  2. In the Data Source Configuration Wizard, select "Database" and then "Dataset". Click "New Connection..." to proceed to connection settings.

  3. Change the database type to "Microsoft Access Database File (OLE DB)" and search for the sample "CarsDB.mdb" file. Click "OK" to add a new connection.

  4. Select the "Cars Scheduling" table and click "Finish".

  5. Each appointment has data associated with it: start and end time stamps, descriptions, labels, etc. To display appointments, the Scheduler needs to know which appointment properties relate to which data source fields. The process of binding appointment properties to source fields is called mapping. This operation is performed in the "Setup Appointment Storage" dialog that pops up automatically after binding the storage to a data source. Should you need to modify these mappings later on, invoke a control or a storage smart tag and click "Mappings Wizard..."

  6. You can set up all required mappings manually, or trust the Wizard to do it for you: click the "Generate" button to scan data source fields and automatically assign them to properties.

    Important

    This sample database contains the "CarID" field, which attaches itself to the "ResourceID" property if you generate mappings automatically. Since you have no appointment resources yet, clear this specific mapping, or else the Scheduler shows no appointments.

  7. The final Wizard page shows all data source fields that remain unmapped, and allows you to bind them to custom fields. You can skip this step for now and click "Finish".

  8. Visual Studio adds two standard WinForms components when you bind to the MS Access database - DataSet and TableAdapter. Invoke the adapter's smart tag menu, choose "Preview Data..." and then click the "Preview" button. Inspect the loaded database records: all sample appointments belong to the last three months of 2016.

    The Scheduler focuses the current day by default, so to browse these database appointments you have to scroll the Scheduler a few years back every time you run the project. To overcome this inconvenience, set the control's SchedulerControl.Start property to October 13, 2016 - the day of the first sample appointment.

  9. Run the application to test the result.

  10. To customize appointment backgrounds (Labels) and side strips (Statuses), edit the storage SchedulerDataStorage.Labels and SchedulerDataStorage.Statuses collections. At design time, you can click these properties' ellipsis buttons in the Visual Studio Property Grid and modify items colors and captions.

    Alternatively, you can bind these collections to separate data sources in the same way as with appointments.

Expanded Resources

In real-life applications, appointments often have related resources. A resource is an entity that owns appointments. For instance, the sample CardsDB database belongs to a fictional car rental agency. In this case, any car owned by this agency is a resource that has related appointments (time intervals during which these cars are leased, washed or repaired). In this section, you will learn how to add these resources to the Scheduler.

  1. Open the "Resources Data Source" editor in the Scheduler's smart tag and repeat the same steps performed for appointments. Use the project's existing connection, but this time select the ”Cars” table.

  2. When the Mapping Wizard pops up, use the following mappings:

    • Caption: Model
    • Color: (none)
    • ID: ID
    • Image: Picture
    • ParentId: (none)
  3. Now when you have resources, restore appointment "ResourceID" property mapping removed earlier. Assign the "CarID" data field to this property.

  4. Run the application and add a new appointment or modify an existing one: the appointment edit form now allows you to choose a parent resource.

    Note

    To modify a recurring appointment's resource, click the "Recurrence" Ribbon command or right-click the appointment and select "Edit Series". If you edit a single instance of a recurring appointment, the resource selector is disabled.

  5. Set the SchedulerControl.GroupType property to Resources to display resources on main Scheduler screen and organize appointments under their parent resources. The number of simultaneously visible resources is managed for each View individually via the SchedulerViewBase.ResourcesPerPage property.

    Use properties from the SchedulerOptionsView.ResourceHeaders group to customize the resource header bar. The image above was taken using the following settings:

Expanded Custom Appointment Edit Form

You can slightly modify the Edit Appointment form (e.g., rename the "Resource" label to "Car" in this example) or completely re-design this form and make it display custom field values, not shown by default. In this section, the editor for the custom "Contacts" field is added.

  1. Click the SchedulerControl's smart tag to invoke the SchedulerControl Tasks menu and click the Create Custom Appointment Form item.

    In the invoked Customize Appointments Form window, select the Default layout and click OK.

    Tip

    Note that if you select the OutlookStyle layout, the steps that follows are essentially the same (except those related to the layout itself).

  2. Open the CustomAppointmentForm in design mode. Drag the LabelControl control and the MemoExEdit control from the DX.18.1: Common Controls Toolbox tab to the form.

    In the Properties window, set the Text property of LabelControl to Contacts:, and change the Name property of the MemoExEdit control to mxContacts.

  3. To add the capability to obtain a custom field value or set a custom appointment field, modify the LoadFormData(), SaveFormData() and IsAppointmentChanged() methods in the CustomAppointmentForm code file.

    Show Me

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

  4. Run the application to see the result.

Expanded Converters

There are cases when a real data source does not contain a field that matches a required appointment\resource property. For example, the sample database stores three categories of cars - sports, truck, and saloon. You cannot map this "Category" field to the resource's "Color" property so that all resources that belong to the same category have the same color. This is not possible because the data source field stores strings, and the resource property accepts colors (in various formats, see the ResourceDataStorage.ColorSaving property to learn more). To overcome this issue, use Mapping Converters that allow you to modify data source values.

Declare a custom converter class that implements the ISchedulerMappingConverter interface, implement the conversion logic, create a new converter instance and assign it to the required <Mapping_Property_Name>Converter property. The following code converts category names to colors and implements the scenario described above: trucks are LightSeaGreen, sport cars are LightCoral and saloons are LightGoldenrodYellow.

Is this topic helpful?​​​​​​​