Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Collapse]Scheduler (legacy)
   [Expand]Overview
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Visual Elements
   [Collapse]Examples
    [Expand]Appearance
    [Collapse]Data Binding
      How to: Bind a Scheduler to MS Access Database (Part 1) (legacy)
      How to: Bind a Scheduler to MS Access Database (Part 2) (legacy)
      How to: Bind a Scheduler to Data via ObjectDataProvider (legacy)
      How to: Create a Custom Field for an Appointment (legacy)
      How to: Filter Appointments (legacy)
      How to: Filter Resources (legacy)
    [Expand]Data Exchange
    [Expand]Date and Time
    [Expand]Forms
    [Expand]Initial Settings
    [Expand]Menu
    [Expand]Printing
    [Expand]Protection
    [Expand]Range Control
    [Expand]Recurrence
    [Expand]Selection
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Bind a Scheduler to MS Access Database (Part 2) (legacy)

Note

You are viewing documentation for the legacy WPF Scheduler control. If you're starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.

In real-world scheduling applications, an appointment is seldom processed "as is", and is usually assigned to different resources. The developer decides what is a resource, and provides resource data to a scheduling application. This document contains an example of task scheduling, and illustrates the concept of resources for appointments.

  • An Educational Center.
    Resources: Every teacher who works at this center.
    Appointment: A time interval when any one of the teachers is delivering a lecture.

Events are usually linked with objects. For example, if we represent lessons as events, they are linked with teachers as objects. Thus, some teachers (objects) conduct different lessons (events). In Scheduler terms, the objects to which appointments are linked are called Resources. (See Resources for more information.) The following image demonstrates a visual representation of a resource.

This topic describes how to add resources to a scheduling application, and how to link these resources to appointments. In this example, we will use the Cars table of the CarsDB database as the resource for the scheduler.

This lesson consists of the following sections.

Expanded Create Data Objects

  1. Open the WPF Application containing the SchedulerControl that was created in How to: Bind a Scheduler to MS Access Database (Part 1) (legacy) document.

  2. This SchedulerControl should already be bound to the CarScheduling table of the CarsDB database (by default, the CarsDB.mdb file that is placed in C:\Users\Public\Documents\DXperience 17.2 Demos\Data). To bind the scheduler to the Cars table of the same database, this table must be added to the CarsDBDataSet schema. To do this, open the CarsDBDataSet.xsd designer by double-clicking the corresponding item in the Solution Explorer.

  3. When the designer is opened, expand the Server Explorer pane, which shows all data connections that are currently available in Visual Studio. To do this, select the Server Explorer item in the View menu, or press CTRL+ALT+S.

  4. In the list of available Data Connections, expand the CarsDB.mdb node, select the ID, Model and Picture fields of the Cars table, and drop them onto the designer. This will add the Cars table with the specified fields to CarsDBDataSet.

  5. When the Cars table is added to the dataset schema, the one-to-many relationship (a single row in the first table can be related to one or more rows in the second table, while a row in the second table can only be related to one row in the first table) between the Cars table and CarScheduling table is automatically created by Visual Studio. To apply these changes, click Save in the Standard toolbar in Visual Studio, or press CTRL+S.

Next, as you did in the previous lesson for appointments, you will need to bind a scheduler to resource data and specify standard mappings for resource properties.

Expanded Bind the Scheduler to Data

All resource data is stored in the Cars data table. This data should be provided to the ResourceStorage object, which is returned by the SchedulerStorage.ResourceStorage property. To bind the storage to data, set the DataSource property to the Cars data table. It is also necessary to populate the DataTable object with data from the database using the Fill method of the CarsTableAdapter object.

Add the following code to the Main Window implementation.

Next, you will map all required data fields for scheduler resources.

Expanded Specify Mappings

Set the Storage.AppointmentStorage.Mappings.ResourceId property value to CarId. This property specifies a unique identifier of the appointment's associated resource.

Next, set Storage.ResourceStorage mappings (Caption, Id and Image) as illustrated in the image below.

As a result, you should have the following XAML. (If your XAML does not look like the following, overwrite it.)

Customize the Scheduler to display events grouped by car.

Expanded Customize the Scheduler

  • Group Appointments by Resources

    To group the scheduler data by resource, set the GroupType property value to Resource:

  • Set the Number of Resources Displayed

    In our example, there are many resources in the ResourceStorage, making the scheduler area appear cluttered. To avoid this, use the SchedulerViewBase.ResourcesPerPage property to specify the number of resources shown on the screen at a time.

    To do this, set the WeekView.ResourcesPerPage property value to 3:

    Finally, your XAML should appear as follows. (If it does not look like the code below, then overwrite it.)

Expanded Result

Run the project. The following image shows the application at runtime:

Expanded See Also

Show Me

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

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