'Declaration Public Event WeekHeaderClicked As WeekHeaderClickedEventHandler
public event WeekHeaderClickedEventHandler WeekHeaderClicked
The event handler receives an argument of type WeekHeaderClickedEventArgs containing data related to this event. The following WeekHeaderClickedEventArgs properties provide information specific to this event.
Property | Description |
---|---|
SelectWeek | Gets/sets whether the Week will be selected. |
Week | Returns the Week object associated with the header that was clicked. |
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
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; private void button1_Click(object sender, System.EventArgs e) { // Set the WeekHeaderDisplayStyle property to 'WeekNumber' this.ultraMonthViewSingle1.WeekHeaderDisplayStyle = WeekHeaderDisplayStyle.WeekNumber; } private void 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) ); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2