How to: Load Holidays from an XML file
To load holidays in the scheduler, you can use XML file which is actually a serialized HolidayBaseCollection object.
This file contains holidays for several countries in the following format:
<Holidays>
<Holiday Date="04/25/2012 00:00:00" DisplayName="Anzac Day" Location="Australia">
<Holiday Date="04/25/2013 00:00:00" DisplayName="Anzac Day" Location="Australia">
<Holiday Date="04/25/2014 00:00:00" DisplayName="Anzac Day" Location="Australia">
<Holiday Date="04/25/2015 00:00:00" DisplayName="Anzac Day" Location="Australia">
...
</Holidays>
The Scheduler library provides the supplementary DevExpress.Schedule.Serializing.HolidayCollectionXmlPersistenceHelper class, which is designed to load holidays from the xml file. So, you may obtain a collection of days which are considered holidays for the specific country, and add these holidays to the SchedulerControl.WorkDays collection of a Scheduler Control.
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(path);
HolidayBaseCollection holidays = DevExpress.Schedule.Serializing.HolidayCollectionXmlPersistenceHelper.ObjectFromXml(doc.OuterXml);
var holidaysRussian = from holiday in holidays
where holiday.Location == "Russia"
select holiday;
schedulerControl1.WorkDays.AddRange(holidaysRussian.ToList<Holiday>());