Is it possible to apply multiple colours to a single calendar column? Let me explain what we are trying to achieve. We have a calendar on which we are showing appointments of owners. But we want to show each owner's availability on a single day in different colours and disable the rows of times when they are not available. For example: An owner may be available from 08-11am and then 1-5pm. So the calender column should apply two separate colours for available rows and disable all the rows with a gray colour for non-available rows.
As far as I know in 2008.1, and the version preceding it, this functionality is not available. You can define only one working period for a day. Maybe something changed in the 2008.2, but I didn't had the time to check it out yet.
Thank you for your quick reply. If we won't be able to apply multiple working periods the calendar is not fully operational. If you find anything in the new version please can you let me know?
SInce this article was originally posted, we have added support for specifying working hours on a daily, weekly or even recurring basis. In the NetAdvantage 2009 Volume 1 release, a DateSettings and RecurringDateSettings collection was added to the Owner object. The objects that you add to these collections provide a way to designate any number of time ranges as working hours (for example, one for 9AM to 12PM and another for 1PM to 5PM), as well as a way to customize the color of time slots for a given range. We leveraged our existing date recurrence engine so that you can specify a recurrence pattern for these objects, so that you can set the working hours (for example) for the first Tuesday of every 3rd month, using only one object.
This allows me to set the working hours, but not the work not the working hours date.
this.dayView.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Friday].WorkDayStartTime = start;this.dayView.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Friday].WorkDayEndTime = start.AddHours(8);
There is no way to specify more than one working hour range per day through the public object model, but the following KB article demonstrates a solution to the general problem of how to arbitrarily color individual TimeSlots:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=5595
Note that the UIElement.GetContext method is used herein to get a reference to a TimeSlot object from the TimeSlotUIElement; this method can alos be used to get a reference to the Owner by using "typeof(Owner)" instead of "typeof(TimeSlot)". You can also use "typeof(DateTime)" to get the date of the TimeSlot (TimeSlot objects are associated with a specific time but not with a specific date). Between the TimeSlot, Owner, and date, you have all the information needed to describe a TimeSlotUIElement, and the code in this article shows you how to change the color.