Version

Appointments Property (Week)

Returns the appointments collection for this week
Syntax
'Declaration
 
Public ReadOnly Property Appointments As AppointmentsSubsetCollection
public AppointmentsSubsetCollection Appointments {get;}
Example
This example uses the properties of the control's VisibleWeek property to obtain information about that week.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports Infragistics.Win.UltraWinSchedule.WeekView

    Private Sub GetVisibleWeekInfo()

        Dim info As String = String.Empty

        '	Add an appointment to each visible, enabled day in the week
        Dim dow As Infragistics.Win.UltraWinSchedule.DayOfWeek

        Dim i As Integer
        For i = 0 To 6

            Dim temp As DateTime = Me.ultraWeekView.VisibleWeek.FirstDate.AddDays(i)

            '	Get the day of the week to which this day corresponds
            dow = Me.ultraWeekView.CalendarInfo.DaysOfWeek(Me.ultraWeekView.VisibleWeek.FirstDate.DayOfWeek)

            '	If the DayOfWeek is hidden, continue
            If dow.Visible Then

                '	Add an appointment for the day
                Me.ultraWeekView.CalendarInfo.Appointments.Add(temp, "Appointment for " + temp.ToString("d"))
            End If

        Next

        '	Get the first and last date in the week
        info += "VisibleWeek information:" + vbCrLf
        info += "The first date in the VisibleWeek is " + Me.ultraWeekView.VisibleWeek.FirstDate.ToLongDateString() + vbCrLf
        info += "The last date in the VisibleWeek is " + Me.ultraWeekView.VisibleWeek.LastDate.ToLongDateString() + vbCrLf

        '	See if there is any activity for the week if there is, display
        '	the count of each activity collection
        If (Me.ultraWeekView.VisibleWeek.HasActivity) Then

            info += "There is activity for the week of " + Me.ultraWeekView.VisibleWeek.FirstDate.ToShortDateString() + ":" + vbCrLf

            If Me.ultraWeekView.VisibleWeek.Appointments.Count > 0 Then
                info += vbCrLf + Me.ultraWeekView.VisibleWeek.Appointments.Count.ToString() + " Appointment(s)" + vbCrLf
            End If
            If (Me.ultraWeekView.VisibleWeek.Holidays.Count > 0) Then
                info += vbCrLf + Me.ultraWeekView.VisibleWeek.Holidays.Count.ToString() + " Holiday(s)" + vbCrLf
            End If
            If (Me.ultraWeekView.VisibleWeek.Notes.Count > 0) Then
                info += vbCrLf + Me.ultraWeekView.VisibleWeek.Notes.Count.ToString() + " Note(s)" + vbCrLf
            End If

            info += vbCrLf

        End If

        '	See if the week is enabled
        If Me.ultraWeekView.VisibleWeek.Enabled Then
            info += "The week is enabled." + vbCrLf
        Else
            info += "The week is disabled." + vbCrLf
        End If

        '	Get the number of the week in its year
        info += "This week is week number " + Me.ultraWeekView.VisibleWeek.WeekNumber.ToString() + " in the year " + Me.ultraWeekView.VisibleWeek.Year.YearNumber.ToString() + "." + vbCrLf

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

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

		private void GetVisibleWeekInfo()
		{

			string info = string.Empty;

			//	Add an appointment to each visible, enabled day in the week
			Infragistics.Win.UltraWinSchedule.DayOfWeek dow = null;

			for ( int i = 0; i < 7; i ++ )
			{
				DateTime temp = this.ultraWeekView.VisibleWeek.FirstDate.AddDays( (double)(i) );

				//	Get the day of the week to which this day corresponds
				dow = this.ultraWeekView.CalendarInfo.DaysOfWeek[ this.ultraWeekView.VisibleWeek.FirstDate.DayOfWeek ];

				//	If the DayOfweek is hidden, continue
				if ( ! dow.Visible )
					continue;

				//	Add an appointment for the day
				this.ultraWeekView.CalendarInfo.Appointments.Add( temp, "Appointment for " + temp.ToString("d") );
			}

			//	Get the first and last date in the week
			info += "VisibleWeek information:\n\n";
			info += "The first date in the VisibleWeek is " + this.ultraWeekView.VisibleWeek.FirstDate.ToLongDateString() + "\n";
			info += "The last date in the VisibleWeek is " + this.ultraWeekView.VisibleWeek.LastDate.ToLongDateString() + "\n";

			//	See if there is any activity for the week; if there is, display
			//	the count of each activity collection
			if ( this.ultraWeekView.VisibleWeek.HasActivity )
			{
				info += "There is activity for the week of " + this.ultraWeekView.VisibleWeek.FirstDate.ToShortDateString() + ":" + "\n";

				if ( this.ultraWeekView.VisibleWeek.Appointments.Count > 0 )
					info += "\n" + this.ultraWeekView.VisibleWeek.Appointments.Count.ToString() + " Appointment(s)\n";

				if ( this.ultraWeekView.VisibleWeek.Holidays.Count > 0 )
					info += "\n" + this.ultraWeekView.VisibleWeek.Holidays.Count.ToString() + " Holiday(s)\n";

				if ( this.ultraWeekView.VisibleWeek.Notes.Count > 0 )
					info += "\n" + this.ultraWeekView.VisibleWeek.Notes.Count.ToString() + " Note(s)\n";

				info += "\n";
			}

			//	See if the week is enabled
			if ( this.ultraWeekView.VisibleWeek.Enabled )
				info += "The week is enabled.\n";
			else
				info += "The week is disabled.\n";

			//	Get the number of the week in its year
			info += "This week is week number " + this.ultraWeekView.VisibleWeek.WeekNumber.ToString() + " in the year " + this.ultraWeekView.VisibleWeek.Year.YearNumber.ToString() + ".\n";

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

		}
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