How to Add Holidays to a Scheduler at Design-Time
- 2 minutes to read
The following example demonstrates how to add holidays to the scheduler using the TcxSchedulerHolidays component at design time.
Follow the steps below:
Drop the TcxSchedulerHolidays component onto a form from the Component Palette‘s DevExpress page.
Double-click the TcxSchedulerHolidays component to open the Holidays editor dialog.
Using the Holidays editor dialog, create holiday locations and holidays associated with these locations, or import predefined holidays from a file, which supports the Microsoft Outlook’s HOL format.
In the Holidays editor dialog, click check boxes against locations and holidays (that you want to schedule) to make them available to the scheduler.
5)Using the Object Inspector, bind the TcxSchedulerHolidays component to the scheduler via the scheduler’s Storage.Holidays property.
- To enable holiday highlighting in the Date Navigator, set the scheduler’s DateNavigator.ShowDatesContainingHolidaysInColor property to True, and specify the color used to paint these dates using the scheduler’s DateNavigator.HolidayColor property (if necessary).
- And lastly, user events that represent these holidays must be scheduled at runtime. To do this, invoke the scheduler storage’s GenerateHolidayEvents method in code, as shown in the following example:
// ...
// to associate user events with a specific resource, pass the resource identifier to the method as an argument
Scheduler.Storage.GenerateHolidayEvents(Null);
To invoke the Holidays editor dialog in code, use the cxShowHolidaysEditor routine.