Version

OnAfterSelectedDateRangeChange Method

Raises the AfterSelectedDateRangeChange event after a DateRange is removed from the SelectedDateRanges collection.
Syntax
'Declaration
 
Protected Overridable Sub OnAfterSelectedDateRangeChange( _
   ByVal e As EventArgs _
) 
protected virtual void OnAfterSelectedDateRangeChange( 
   EventArgs e
)

Parameters

e
A System.EventArgs that provides data for the event.
Remarks

Raising an event invokes the event handler through a delegate.

The OnAfterSelectedDateRangeChange method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Holidays to Inheritors: When overriding OnAfterSelectedDateRangeChange in a derived class, be sure to call the base class's OnAfterSelectedDateRangeChange method so that registered delegates receive the event.

Example
This example displays information about the currently selected days.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics

    Private Sub ultraCalendarInfo1_AfterSelectedDateRangeChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles ultraCalendarInfo1.AfterSelectedDateRangeChange

        '----------------------------------------------------------------------------------------------------
        '	Description
        '	AfterSelectedDateRangeChange
        '
        '	Fires after a range of days is selected or deselected.
        '
        '	The SelectedDateRanges collection is actually a collection of collections,
        '	each "sub collection" representing the actual days that are selected. Each
        '	DateRange object represents a contiguous range of days that are all selected.
        '	When new days are selected, they are added to an existing DateRange object,
        '	if the new day is adjacent to a currently selected day. If it is not, a new DateRange
        '	object is added to the collection, which will at that point have only one day in it.
        '
        '----------------------------------------------------------------------------------------------------

        '	If there are no selected days, don't display the information
        If (Me.ultraCalendarInfo1.SelectedDateRanges.Count = 0) Then Return

        Dim info As String = String.Empty
        info += "The range of selected days has changed. The currently selected days are:" + vbCrLf + vbCrLf

        '	Iterate the SelectedDateRanges in the outer loop
        Dim range As Infragistics.Win.UltraWinSchedule.DateRange
        For Each range In Me.ultraCalendarInfo1.SelectedDateRanges

            '	Iterate the range's Days collection in the inner loop
            Dim day As Infragistics.Win.UltraWinSchedule.Day
            For Each day In range.Days

                '	Append each day's information to the info string
                info += day.Date.ToLongDateString() + vbCrLf
            Next
        Next

        '	Display the information
        MessageBox.Show(info, "AfterSelectedDateRangeChange", MessageBoxButtons.OK)

    End Sub
using System.Diagnostics;
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;

		private void ultraCalendarInfo1_AfterSelectedDateRangeChange(object sender, System.EventArgs e)
		{

			//----------------------------------------------------------------------------------------------------
			//	Description
			//	AfterSelectedDateRangeChange
			//
			//	Fires after a range of days is selected or deselected.
			//
			//	The SelectedDateRanges collection is actually a collection of collections,
			//	each "sub collection" representing the actual days that are selected. Each
			//	DateRange object represents a contiguous range of days that are all selected.
			//	When new days are selected, they are added to an existing DateRange object,
			//	if the new day is adjacent to a currently selected day. If it is not, a new DateRange
			//	object is added to the collection, which will at that point have only one day in it.
			//
			//----------------------------------------------------------------------------------------------------
		
			//	If there are no selected days, don't display the information
			if ( this.ultraCalendarInfo1.SelectedDateRanges.Count == 0 )
				return;

			string info = string.Empty;
			info += "The range of selected days has changed. The currently selected days are:" + "\n\n";

			//	Iterate the SelectedDateRanges in the outer loop
			foreach( DateRange range in this.ultraCalendarInfo1.SelectedDateRanges )
			{

				//	Iterate the range's Days collection in the inner loop
				foreach( Infragistics.Win.UltraWinSchedule.Day day in range.Days )
				{
					//	Append each day's information to the info string
					info += day.Date.ToLongDateString() + "\n";
				}
			}

			//	Display the information
			MessageBox.Show( info, "AfterSelectedDateRangeChange", MessageBoxButtons.OK );

		}
Requirements

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

See Also