Version

Working Days and Working Hours (XamScheduler)

Purpose

This topic explains the control’s working days and working hours concepts.

Required Background

Topic Purpose

This topic provides an overview of the XamScheduler control.

This topic explains how to bind the control to a data source using ScheduleListDataSource.

Overview

The XamScheduler control supports working days and working hours. This is basically a set of settings which describe which days and hours are working and which are not working. The control renders working and non-working days and hours differently (for example with a different background color). You can configure the control to show or hide the non-working days and hours using the WorkingHoursDisplayMode property.

Control-Level

To define working hours and working days on a control-level you can use the XamScheduler.DaysOfWeekSettings property.

By default, all days except for Saturday and Sunday are considered workdays and working hours are 9AM to 5PM.

The following code example demonstrates how to create a custom working days and working hours schedule on a control-level:

In C#:

WorkingHoursCollection morningShift = new WorkingHoursCollection();
morningShift.Add(new TimeSpan(6, 0, 0), new TimeSpan(14, 0, 0));
WorkingHoursCollection afternoonShift = new WorkingHoursCollection();
afternoonShift.Add(new TimeSpan(14, 0, 0), new TimeSpan(22, 0, 0));

this.scheduler.DaysOfWeekSettings = new ScheduleDaysOfWeekSettings()
{
  Monday = new ScheduleDayOfWeekSettings()
    { IsWorkday = true, WorkingHours = morningShift },
  Tuesday = new ScheduleDayOfWeekSettings()
    { IsWorkday = false },
  Wednesday = new ScheduleDayOfWeekSettings()
    { IsWorkday = true, WorkingHours = afternoonShift },
  Thursday = new ScheduleDayOfWeekSettings()
    { IsWorkday = false },
  Friday = new ScheduleDayOfWeekSettings()
    { IsWorkday = true, WorkingHours = morningShift },
  Saturday = new ScheduleDayOfWeekSettings()
    { IsWorkday = false },
  Sunday = new ScheduleDayOfWeekSettings()
    { IsWorkday = true, WorkingHours = afternoonShift }
};

Resource-Level

You can also define working days and working hours on a resource-level using the DaysOfWeekSettings property.

Note
Note

Configuring a resource-level working days and working hours has higher precedence and will overwrite the settings set on the control-level.

The following code example demonstrates how to create a custom working days and working hours schedule on a resource-level:

In C#:

WorkingHoursCollection morningShift = new WorkingHoursCollection();
morningShift.Add(new TimeSpan(6, 0, 0), new TimeSpan(14, 0, 0));
WorkingHoursCollection afternoonShift = new WorkingHoursCollection();
afternoonShift.Add(new TimeSpan(14, 0, 0), new TimeSpan(22, 0, 0));

ScheduleResource res1 = new ScheduleResource();
res1.DaysOfWeekSettings = new ScheduleDaysOfWeekSettings()
{
  Monday = new ScheduleDayOfWeekSettings()
    { IsWorkday = true, WorkingHours = morningShift },
  Tuesday = new ScheduleDayOfWeekSettings()
    { IsWorkday = false },
  Wednesday = new ScheduleDayOfWeekSettings()
    { IsWorkday = true, WorkingHours = afternoonShift },
  Thursday = new ScheduleDayOfWeekSettings()
    { IsWorkday = false },
  Friday = new ScheduleDayOfWeekSettings()
    { IsWorkday = true, WorkingHours = morningShift },
  Saturday = new ScheduleDayOfWeekSettings()
    { IsWorkday = false },
  Sunday = new ScheduleDayOfWeekSettings()
    { IsWorkday = true, WorkingHours = afternoonShift }
};

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains how data is presented in the XamScheduler's day view.

This topic explains how data is presented in the XamScheduler's week view.