Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
PrivateSub 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 SubPrivateSub ultraMonthViewSingle1_WeekHeaderClicked(ByVal sender AsObject, 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 AsDouble = IIf(dayOfWeek > firstDayInWeek.DayOfWeek, 1.0F, -1.0F)
While (firstDayInWeek.DayOfWeek <> dayOfWeek)
firstDayInWeek = firstDayInWeek.AddDays(sign)
EndWhile' Select the week
monthViewSingle.CalendarInfo.SelectedDateRanges.Clear()
monthViewSingle.CalendarInfo.SelectedDateRanges.Add(firstDayInWeek, firstDayInWeek.AddDays(6.0F))
End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;
privatevoid button1_Click(object sender, System.EventArgs e)
{
// Set the WeekHeaderDisplayStyle property to 'WeekNumber'
this.ultraMonthViewSingle1.WeekHeaderDisplayStyle = WeekHeaderDisplayStyle.WeekNumber;
}
privatevoid ultraMonthViewSingle1_WeekHeaderClicked(object sender, Infragistics.Win.UltraWinSchedule.WeekHeaderClickedEventArgs e)
{
UltraMonthViewSingle monthViewSingle = sender as UltraMonthViewSingle;
// 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
System.DayOfWeek dayOfWeek = monthViewSingle.FirstVisibleDay.Date.DayOfWeek;
// Get the first day of the week
DateTime firstDayInWeek = e.Week.FirstDate;
// Walk either backward or forward to the get the first day
// in the same week displayed by the control
double sign = dayOfWeek > firstDayInWeek.DayOfWeek ? 1f : -1f;
while ( firstDayInWeek.DayOfWeek != dayOfWeek )
{
firstDayInWeek = firstDayInWeek.AddDays( sign );
}
// Select the week
monthViewSingle.CalendarInfo.SelectedDateRanges.Clear();
monthViewSingle.CalendarInfo.SelectedDateRanges.Add( firstDayInWeek, firstDayInWeek.AddDays(6f) );
}