Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Set the WeekHeaderDisplayStyle property to 'WeekNumber'
Me.ultraMonthViewSingle1.WeekHeaderDisplayStyle = WeekHeaderDisplayStyle.WeekNumber
End Sub
Private Sub ultraMonthViewSingle1_WeekHeaderClicked(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.WeekHeaderClickedEventArgs) Handles ultraMonthViewSingle1.WeekHeaderClicked
Dim monthViewSingle As UltraMonthViewSingle = sender
' Set the 'SelectWeek' property of the event arguments to false
' so that the default selection does not take place
e.SelectWeek = False
' Get the first day of the week displayed by the control
Dim dayOfWeek As System.DayOfWeek = monthViewSingle.FirstVisibleDay.Date.DayOfWeek
' Get the first day of the week
Dim firstDayInWeek As DateTime = e.Week.FirstDate
' Walk either backward or forward to the get the first day
' in the same week displayed by the control
Dim sign As Double = IIf(dayOfWeek > firstDayInWeek.DayOfWeek, 1.0F, -1.0F)
While (firstDayInWeek.DayOfWeek <> dayOfWeek)
firstDayInWeek = firstDayInWeek.AddDays(sign)
End While
' Select the week
monthViewSingle.CalendarInfo.SelectedDateRanges.Clear()
monthViewSingle.CalendarInfo.SelectedDateRanges.Add(firstDayInWeek, firstDayInWeek.AddDays(6.0F))
End Sub