Skip to main content Skip to footer

Creating Multi-User Schedules with Grouping

Microsoft Outlook enables you to view multiple calendars (or schedules) side by side. This popular feature has inspired the new grouping functionality added to ComponentOne Scheduler for Silverlight/WPF in the 2010 v3 release.

Grouping can be considered a data-level feature, much like in a DataGrid control. You apply grouping on the appointment data to view multiple schedules side-by-side in the same viewport, with each appointment displaying in the group or groups it's assigned. The C1Scheduler control supports grouping by contacts, categories, resources, and by the Owner property. Each appointment can be assigned to one or more of these items, thus making this feature work.

Key Features of Grouping

  • Paging - there's no limit to the number of unique groups. C1Scheduler will provide paging through the groups so it fits nicely on your form.
  • Group Page Size - specify the number of groups to display on each page.
  • Any Scheduler Views - grouping is supported in any view so you don't have to rewrite existing code to add this feature.
  • Empty Group Item - show appointments which are not assigned to any group in an empty group
  • Flexible Grouping - group on resources, categories, contacts or even a separate entity such as Employees
  • Customize the Group Header - add more information such as descriptions and images to the group header

Getting Started

Enabling grouping is as easy as setting 2 properties. Set the GroupBy property to a string value of "Category", "Contact" or "Resource" (see below for grouping by Owner). Then set the GroupPageSize property to an integer determining the number of grouped items to display in a single view. For example, let's set GroupBy to "Category" and GroupPageSize to 2. C1Scheduler includes 20 default categories, so we can see grouping in action without needing to supply more information such as contacts or resources.

Now we can have multiple schedules, one for each category, in our view. The benefit of using this feature over just placing multiple C1Scheduler controls on our page is that we have paging through an unlimited number of groups, a single view port (scrollbar), and date navigation/synchronization. We can also move appointments across groups without having to configure this action ourselves.

At run-time, double-click on the scheduler to bring up the new appointment dialog. At the bottom of the dialog you will see contact, resource and category information. Clicking any of these buttons will open additional dialogs allowing the user to manage contact, resource and category information. By default, the appointment will already be assigned to the group in which I clicked. For instance, this appointment is assigned to the Business category.

Of course, the dialogs and the available categories can be completely customized to provide a more rigid solution. The contact, category and resource information can be obtained from the appointment data so customization is very easy. For instance, you may want to restrict the user to just selecting from several contacts, rather than giving them the freedom to manage the contacts.

In this sample i've grouped on category, so if I add an appointment for some categories it will display in each group. What's neat about this is that the appointment becomes shared. Any changes I make to one instance of the shared appointment will apply to all groups.

Support for any View

Grouping is supported in any scheduler view. Let's enable the user to change the view by adding a C1Calendar to our page. We can connect the controls by binding the C1Calendar's SelectedDates property to that of C1Scheduler. Also set the MaxSelectionCount property on C1Calendar to 42 to allow up to 42 days (6 weeks) to be selected at once.

XAML:

At run-time, we can select any number of days on C1Calendar and C1Scheduler changes to reflect the same days.

Empty Group Item

C1Scheduler also supports the empty group item. For instance, you may be grouping on Resources and have some appointments that do not have any resources assigned to them. Setting the ShowEmptyGroupItem property to True (default is False) allows you to view these appointments in a single group named Calendar.

c1Scheduler1.ShowEmptyGroupItem = true;

Creating a Multi-User Application

All of the resource, category and contact information associated with each appointment gets stored in the AppointmentProperties field. But in some scenarios, this may not be the most convenient way for creating multi-user schedules. So in addition to grouping by these 3 collections, C1Scheduler also supports grouping on a new Owner field. The Appointment object has a new Owner property which can be mapped directly to a field in your data source either through the OwnerId or OwnerIndex mapping (OwnerId maps to GUID, OwnerIndex maps to integers).

So now your data model can look like this,

You can easily map appointments to a different entity and group appointments by that entity. The relationship can be one-to-many or many-to-many. To achieve this you set the GroupBy property to "Owner" and provide the datastorage mapping of the OwnerId/OwnerIndex field.

We have included a more indepth sample with C1Scheduler called MultiUser. This sample shows how you can fully bind your appointment data source with a related owner table. In this case we use the Northwind Employees table. The sample also shows how you can customize the grouped header to include more information from the owner table as well as customize the group navigation buttons.

Download MultiUser Sample (WPF)

Download MultiUser Sample (Silverlight 4)

ComponentOne Product Manager Greg Lutz

Greg Lutz

comments powered by Disqus