this.scheduleControl1.HeaderLabel.TextChanged += new EventHandler(HeaderLabel_TextChanged);
void HeaderLabel_TextChanged(object sender, EventArgs e)
{
//code
}
AddHandler Me.scheduleControl1.Calendar.DateValueChanged, AddressOf Calendar_DateValueChanged
Private Sub Calendar_DateValueChanged(ByVal sender As Object, ByVal e As EventArgs)
'To get the top left date in month calendar.
Dim startTime As DateTime = Me.scheduleControl1.Calendar.TopLeftDate
'To get all the dates of current selected month date.
Dim selectedDates = Me.scheduleControl1.Calendar.SelectedDates
'To get the schedule view
Dim type As ScheduleViewType = Me.scheduleControl1.ScheduleType
End Sub |
scheduleControl1.Calendar.DateValueChanged event does NOT fire in ALL circumstances. |
The DateValue for the CalendarGrid will be set internally when the month is changed using the navigation button or ContextMenuItems click is occurred. In order to notify the application when the ScheduleViewType is changed by clicking on the calendar, we suggest you to use the SelectionsChanged event of SelectedDates collection.
Example code
//Event subscription
this.scheduleControl1.Calendar.SelectedDates.SelectionsChanged += Calendar_SelectionsChanged;
//Event suscription
//For DateTimePicker
private void Calendar_SelectionsChanged(object sender, EventArgs e)
{
this.scheduleControl1.Calendar.DateValue = this.scheduleControl1.Calendar.DateValue.AddYears(1);
} |
why does the DateTimePicker start on a Sunday but the displayed dates in the Grid part of the control always starts on a Monday? |
In order to set the Sunday as starting day of the week, the MonthCalendarStartDayOfWeek property can be used.
Example code
//Property For Modify DayOfWeek
scheduleControl1.Appearance.MonthCalendarStartDayOfWeek = DayOfWeek.Sunday;
|