'Declaration Public Event DayOfWeekHeaderClicked As DayOfWeekHeaderClickedEventHandler
public event DayOfWeekHeaderClickedEventHandler DayOfWeekHeaderClicked
The event handler receives an argument of type DayOfWeekHeaderClickedEventArgs containing data related to this event. The following DayOfWeekHeaderClickedEventArgs properties provide information specific to this event.
Property | Description |
---|---|
DayOfWeek | The DayOfWeek object corresponding to the day that was clicked |
The UltraMonthViewSingle control has no specific action defined for when the DayOfWeek headers are clicked. The DayOfWeekHeaderClicked event can be used to perform an application-specific action when a DayOfWeek header is clicked.
Note: When the control's WeekendDisplayStyle property is set to Compressed, the DayOfWeekHeaderClicked event does not fire for Sunday.
Private Sub UltraMonthViewSingle1_DayOfWeekHeaderClicked(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinSchedule.DayOfWeekHeaderClickedEventArgs) Handles ultraMonthViewSingle1.DayOfWeekHeaderClicked '---------------------------------------------------------------------------------------------------- ' Description ' DayOfWeekHeaderClicked ' ' Fires when the control's DayOfWeek headers are clicked ' '---------------------------------------------------------------------------------------------------- ' If the control key is not down, we will clear existing selections If (Control.ModifierKeys And Keys.Control) = 0 Then Me.ultraMonthViewSingle1.CalendarInfo.SelectedDateRanges.Clear() End If ' Get the day of the week of the header that was clicked Dim dow As System.DayOfWeek = e.DayOfWeek.DayOfTheWeek ' Starting with the first visible day in the control, get the date of the ' first visible day that falls on the given day of the week Dim tempDate As DateTime = Me.ultraMonthViewSingle1.FirstVisibleDay.Date If dow = Me.ultraMonthViewSingle1.FirstVisibleDay.Date.DayOfWeek Then Me.ultraMonthViewSingle1.FirstVisibleDay.Selected = True End If Dim i As Integer For i = 0 To 6 tempDate = tempDate.AddDays(1) If tempDate.DayOfWeek = dow Then Exit For Next i ' Create a Day object for that date and select it Dim day As Infragistics.Win.UltraWinSchedule.Day = Me.ultraMonthViewSingle1.CalendarInfo.GetDay(tempDate, True) If Not day Is Nothing Then day.Selected = True ' If there is only one visible week, then our work here is done If Me.ultraMonthViewSingle1.VisibleWeeks = 1 Then Return ' Now, using the control's VisibleWeeks property, select each day ' that falls on the given day of the week by adding weeks to the date ' we selected above Dim weeks As Integer = Me.ultraMonthViewSingle1.VisibleWeeks - 1 For i = 0 To weeks - 1 tempDate = tempDate.AddDays(7) day = Me.ultraMonthViewSingle1.CalendarInfo.GetDay(tempDate, True) If Not day Is Nothing Then day.Selected = True Next End Sub
private void ultraMonthViewSingle1_DayOfWeekHeaderClicked(object sender, Infragistics.Win.UltraWinSchedule.DayOfWeekHeaderClickedEventArgs e) { //---------------------------------------------------------------------------------------------------- // Description // DayOfWeekHeaderClicked // // Fires when the control's DayOfWeek headers are clicked // //---------------------------------------------------------------------------------------------------- // If the control key is not down, we will clear existing selections if ( ( Control.ModifierKeys & Keys.Control ) == 0 ) this.ultraMonthViewSingle1.CalendarInfo.SelectedDateRanges.Clear(); // Get the day of the week of the header that was clicked System.DayOfWeek dow = (System.DayOfWeek)(e.DayOfWeek.DayOfTheWeek); // Starting with the first visible day in the control, get the date of the // first visible day that falls on the given day of the week DateTime tempDate = this.ultraMonthViewSingle1.FirstVisibleDay.Date; if ( dow == this.ultraMonthViewSingle1.FirstVisibleDay.Date.DayOfWeek ) this.ultraMonthViewSingle1.FirstVisibleDay.Selected = true; for ( int i = 0; i < 7; i ++ ) { tempDate = tempDate.AddDays( 1.0F ); if ( tempDate.DayOfWeek == dow ) break; } // Create a Day object for that date and select it Infragistics.Win.UltraWinSchedule.Day day = this.ultraMonthViewSingle1.CalendarInfo.GetDay( tempDate, true ); if ( day != null ) day.Selected = true; // If there is only one visible week, then our work here is done if ( this.ultraMonthViewSingle1.VisibleWeeks == 1 ) return; // Now, using the control's VisibleWeeks property, select each day // that falls on the given day of the week by adding weeks to the date // we selected above int weeks = this.ultraMonthViewSingle1.VisibleWeeks - 1; for ( int i = 0; i < weeks; i ++ ) { tempDate = tempDate.AddDays( 7.0F ); day = this.ultraMonthViewSingle1.CalendarInfo.GetDay( tempDate, true ); if ( day != null ) day.Selected = true; } }
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