Version

Holidays Property (Day)

Returns the holidays collection for this day
Syntax
'Declaration
 
Public ReadOnly Property Holidays As HolidaysSubsetCollection
public HolidaysSubsetCollection Holidays {get;}
Example
This example uses the Day object to retrieve information about the current day.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.IO
Imports System.Globalization

    Private Sub GetDayInfo()

        Dim info As String = String.Empty

        '	Create a Day object for the current date
        Dim day As Infragistics.Win.UltraWinSchedule.Day = Me.ultraCalendarInfo1.GetDay(DateTime.Today, True)

        '	Add a few appointments, holidays, and notes to the current day
        Me.ultraCalendarInfo1.Appointments.Add(day.Date, "Today's Appointment #1")
        Me.ultraCalendarInfo1.Appointments.Add(day.Date, "Today's Appointment #2")
        Me.ultraCalendarInfo1.Appointments.Add(day.Date, "Today's Appointment #3")
        Me.ultraCalendarInfo1.Holidays.Add(day.Date, "Today's Holiday")
        Me.ultraCalendarInfo1.Notes.Add(day.Date, "Today's Note #1")
        Me.ultraCalendarInfo1.Notes.Add(day.Date, "Today's Note #2")

        '	Get the date of the day
        info += "The date of the day is " + day.Date.ToLongDateString() + "." + vbCrLf

        '	Get the day of the week of the day
        info += "The day falls on a " + day.DayOfWeek.DayOfTheWeek.ToString() + "." + vbCrLf

        '	Get the number of the week that the day falls in
        info += "The day falls in week number " + day.Week.WeekNumber.ToString() + " of the year." + vbCrLf

        '	Get the number of the day in its month, and the name of the month
        Dim monthName As String = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames(day.Month.MonthNumber - 1)
        info += "The day is day number " + day.DayNumber.ToString()
        info += " in the month of " + monthName + "." + vbCrLf

        '	Get approximately how far into the month the day is
        Dim daysInMonth As Integer = day.Month.DaysInMonth
        Dim elapsed As Double = (day.DayNumber) / (daysInMonth)
        elapsed *= 100
        info += "The day is approximately " + elapsed.ToString("n") + "% of the way into the month." + vbCrLf

        '	Get the number of the year
        info += "The day is in the year " + day.Month.Year.YearNumber.ToString() + "." + vbCrLf

        '	Get approximately how far into the year the day is
        Dim daysInYear As Integer = 365

        If day.Month.Year.IsLeapYear Then daysInYear = 366

        elapsed = (day.DayOfYear) / (daysInYear)
        elapsed *= 100
        info += "The day is approximately " + elapsed.ToString("n") + "% of the way into the year." + vbCrLf

        '	If there is activity, display the number of each type
        If (day.HasActivity) Then

            Dim activity As String = String.Empty

            If (day.Appointments.Count > 0) Then
                activity += day.Appointments.Count.ToString() + " Appointment(s)" + vbCrLf
            End If
            If (day.Holidays.Count > 0) Then
                activity += day.Holidays.Count.ToString() + " Holiday(s)" + vbCrLf
            End If
            If (day.Notes.Count > 0) Then
                activity += day.Notes.Count.ToString() + " Note(s)" + vbCrLf

            End If
            info += "There is activity for the day :" + vbCrLf + vbCrLf
            info += activity + vbCrLf


        End If

        '	Display whether the day's Enabled property is true or false
        If (day.Enabled) Then
            info += "The day's Enabled property is set to true." + vbCrLf
        Else
            info += "The day's Enabled property is set to false." + vbCrLf
        End If

        '	Display whether the day is effectively enabled
        '
        '	Note that the EnabledResolved property accounts
        '	not only for the day's own Enabled property, but for the
        '	Enabled properties of all objects that encompass that day
        '	(i.e., Week, Month, Year)
        If (day.EnabledResolved) Then
            info += "The day is enabled." + vbCrLf
        Else
            info += "The day is disabled." + vbCrLf
        End If

        '	Display whether the day is the ActiveDay
        If Not Me.ultraCalendarInfo1.ActiveDay Is Nothing And Me.ultraCalendarInfo1.ActiveDay Is day Then
            info += "The day is the ActiveDay." + vbCrLf
        End If

        '	Display whether the day is selected
        If (day.Selected) Then
            info += "The day is selected." + vbCrLf
        End If

        '	Display whether the day has been activated
        If (day.Activated) Then
            info += "The day has been activated." + vbCrLf

            '	Display the information
            MessageBox.Show(info, "GetDayInfo")

        End If

    End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.IO;
using System.Globalization;

		private void GetDayInfo()
		{

			string info = string.Empty;
			
			//	Create a Day object for the current date
			Infragistics.Win.UltraWinSchedule.Day day = this.ultraCalendarInfo1.GetDay( DateTime.Today, true );

			//	Add a few appointments, holidays, and notes to the current day
			this.ultraCalendarInfo1.Appointments.Add( day.Date, "Today's Appointment #1" );
			this.ultraCalendarInfo1.Appointments.Add( day.Date, "Today's Appointment #2" );
			this.ultraCalendarInfo1.Appointments.Add( day.Date, "Today's Appointment #3" );
			this.ultraCalendarInfo1.Holidays.Add( day.Date, "Today's Holiday" );
			this.ultraCalendarInfo1.Notes.Add( day.Date, "Today's Note #1" );
			this.ultraCalendarInfo1.Notes.Add( day.Date, "Today's Note #2" );
			
			//	Get the date of the day
			info += "The date of the day is " + day.Date.ToLongDateString() + ".\n";

			//	Get the day of the week of the day
			info += "The day falls on a " + day.DayOfWeek.DayOfTheWeek.ToString() + ".\n";

			//	Get the number of the week that the day falls in
			info += "The day falls in week number " + day.Week.WeekNumber.ToString() + " of the year.\n";

			//	Get the number of the day in its month, and the name of the month
			string monthName = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames[ day.Month.MonthNumber -1 ];
			info += "The day is day number " + day.DayNumber.ToString();
			info += " in the month of " + monthName + ".\n";

			//	Get approximately how far into the month the day is
			int daysInMonth = day.Month.DaysInMonth;
			double elapsed = (double)(day.DayNumber) / (double)(daysInMonth);
			elapsed *= 100;
			info += "The day is approximately " + elapsed.ToString("n") + "% of the way into the month.\n";

			//	Get the number of the year
			info += "The day is in the year " + day.Month.Year.YearNumber.ToString() + ".\n";

			//	Get approximately how far into the year the day is
			int daysInYear = day.Month.Year.IsLeapYear ? 366 : 365;
			elapsed = (double)(day.DayOfYear) / (double)(daysInYear);
			elapsed *= 100;
			info += "The day is approximately " + elapsed.ToString("n") + "% of the way into the year.\n";

			//	If there is activity, display the number of each type
			if ( day.HasActivity )
			{
				string activity = string.Empty;

				if ( day.Appointments.Count > 0 )
					activity += day.Appointments.Count.ToString() + " Appointment(s)\n";
				if ( day.Holidays.Count > 0 )
					activity += day.Holidays.Count.ToString() + " Holiday(s)\n";
				if ( day.Notes.Count > 0 )
					activity += day.Notes.Count.ToString() + " Note(s)\n";

				info += "There is activity for the day :\n\n";
				info += activity + "\n";
			}

			//	Display whether the day's Enabled property is true or false
			if ( day.Enabled )
				info += "The day's Enabled property is set to true.\n";
			else
				info += "The day's Enabled property is set to false.\n";

			//	Display whether the day is effectively enabled
			//
			//	Note that the EnabledResolved property accounts
			//	not only for the day's own Enabled property, but for the
			//	Enabled properties of all objects that encompass that day
			//	(i.e., Week, Month, Year)
			if ( day.EnabledResolved )
				info += "The day is enabled.\n";
			else
				info += "The day is disabled.\n";

			//	Display whether the day is the ActiveDay
			if ( this.ultraCalendarInfo1.ActiveDay != null &&
				 this.ultraCalendarInfo1.ActiveDay == day )
				info += "The day is the ActiveDay.\n";

			//	Display whether the day is selected
			if ( day.Selected )
				info += "The day is selected.\n";

			//	Display whether the day has been activated
			if ( day.Activated )
				info += "The day has been activated.\n";

			//	Display the information
			MessageBox.Show( info, "GetDayInfo" );

		}
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