I've got my form setup to default to a specific date so I set my calendarInfo.ActiveDay = someDate;
The dayview properly jumps to the correct date but the month view doesn't highlight the current date. If I click on the month view, it will highlight the day I clicked on and from that point on when I set the calendarInfo.ActiveDay property the correct day is highligted in the month view control.
How do I get the active day highligted without the user having to click on the month view first?
Selected and Active are not the same thing. When you set the ActiveDay programmatically, it does not affect selection. When you click on a day, it both selects and activates it. TO programmatically select a date, use the UltraCalendarInfo.SelectedDateRanges collection.
Example:static private void ActivateDay( UltraCalendarInfo calendarInfo, DateTime date, bool select ){ calendarInfo.ActiveDay = calendarInfo.GetDay( date, true );
if ( select ) { calendarInfo.SelectedDateRanges.Clear(); calendarInfo.SelectedDateRanges.Add( date ); }}
Basically everything works as expected except the active day does not have the box around the currently selected day until the user clicks on the month view control. Once they've clicked on the month view control, the box will always stay on the month view control even when the focus is else where and the date is changed via code.
I tried setting the ActiveDay to a date that was not currently visible in the control, and when the button was clicked, the control correctly brought that day into view, so I am not clear on what you mean by, "...dayview properly jumps to the correct date...", i.e., if this means that MonthViewSingle does not do the same thing. Also, please clarify what you mean by "highlight"; by default, the ActiveDay is visually depicted with a focus rectangle, but this is only displayed when the control is focused. Note that UltraCalendarLook exposes an ActiveDayAppearance, which you can use to give the ActiveDay a specific color.