Skip to main content

HolidaysHelper Class

Provides methods used to generate appointments for the scheduler holidays.

Namespace: DevExpress.XtraScheduler.Native

Assembly: DevExpress.XtraScheduler.v24.1.Core.Desktop.dll

NuGet Package: DevExpress.Scheduler.CoreDesktop

Declaration

public static class HolidaysHelper

Remarks

Call the HolidaysHelper.CreateHolidayAppointment method to create an all-day appointment for a certain holiday or the HolidaysHelper.GenerateHolidayAppointments method to create appointments for all holidays contained in the WorkDaysCollection collection of the scheduler.

Example

If you have Microsoft® Outlook installed on your machine, it may be useful to obtain the holidays list, which is shipped with its installation. For example, if you’ve installed Microsoft Office 2013 English (United States) in default location, this file can be found in the following path:

C:\Program Files\Microsoft Office\Office15\1033\Outlook.hol

This file contains all known holidays for several countries (marked in square brackets and called as locations) in the following format:

[United States] 168 Christmas Day,2006/12/25 Christmas Day,2007/12/25 Christmas Day,2008/12/25 Christmas Day,2009/12/25 Christmas Day,2010/12/25 Christmas Day,2011/12/25 Christmas Day,2012/12/25 Christmas Eve,2006/12/24

XtraScheduler provides the supplementary OutlookHolidaysLoader class, which is intended to load holidays from the Outlook.hol file via its FromFile or FromStream methods. So, you may obtain a collection of days which are treated as holidays for the specified country, and add these holidays to the SchedulerControl.WorkDays collection of a Scheduler Control.

The code below demonstrates how this can be done.

OutlookHolidaysLoader loader = new OutlookHolidaysLoader();
HolidayBaseCollection holidays = loader.FromFile(OutlookHolidaysFilePath, Locations);
schedulerControl1.WorkDays.AddRange(holidays);

Inheritance

Object
HolidaysHelper
See Also