Version

PatternDaysOfWeek Property (AppointmentRecurrence)

Gets/sets the day(s) of the week on which each occurrence occurs.
Syntax
'Declaration
 
Public Overrides Property PatternDaysOfWeek As RecurrencePatternDaysOfWeek
public override RecurrencePatternDaysOfWeek PatternDaysOfWeek {get; set;}
Remarks

Note: The value of the PatternDaysOfWeek property is expressed as bitflags, so that multiple days can be represented by the property.

When the PatternFrequency property is set to 'Daily', the PatternDaysOfWeek property can only be set to 'All' or 'AllWeekdays'; setting the property to any other value will result in an exception being thrown.

When the PatternFrequency property is set to 'Weekly', the PatternDaysOfWeek property cannot be set to 'None'; doing so will result in an exception being thrown.

When the PatternFrequency property is set to 'Monthly' or 'Yearly', the PatternDaysOfWeek property is not applicable.

Example
The following example demonstrates how to use the 'PatternDaysOfWeek' property to create recurring appointments.

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

    Private Sub CreateRecurringAppointments()
        ' The 'PatternDaysOfWeek' is used by weekly, 
        ' calculated monthly, calculated yearly and 
        ' also daily appointments that occur every
        ' weekday.
        '

        ' For an every weekday type daily recurrence,
        ' the 'PatternDaysOfWeek' is used to specify
        ' that the appointment is limited to the
        ' weekdays.
        '

        ' create a new appointment
        Dim dailyAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(DateTime.Now, DateTime.Now.AddHours(3D), String.Empty)

        ' create the recurrence object - this appointment
        ' will become the rootappointment (or representation
        ' of the series) - it's 'IsRecurringAppointmentRoot'
        ' will return true and it will not displayed in 
        ' the associated controls. instead, instances or 
        ' occurrences of the recurrence will appear in the
        ' the controls associated with the calendar info.
        dailyAppt.Recurrence = New AppointmentRecurrence()

        ' This will be a daily appointment that will occur
        ' each weekday
        dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily

        ' In this case, we use the 'PatternDaysOfWeek' to
        ' indicate that the daily occurrences should fall
        ' on every weekday (each day but saturday and sunday).
        dailyAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays

        ' assign a subject [not required]
        dailyAppt.Subject = "A daily activity"


        ' For a weekly appointment, the 'PatternDaysOfWeek'
        ' indicates which days of the week, the occurrences
        ' will land upon. e.g. Friday; Monday and Tuesday;
        ' all weekdays; all weekend days; etc.
        '

        ' create a new appointment
        Dim dt As DateTime = DateTime.Now
        Dim weekAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, dt.AddDays(1D), String.Empty)

        ' create the recurrence object - see above for more
        weekAppt.Recurrence = New AppointmentRecurrence()

        ' the 'PatternFrequency' indicates the frequency of the recurrence.
        weekAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Weekly

        ' the recurrence should occur every week
        weekAppt.Recurrence.PatternInterval = 1

        ' The 'PatternDaysOfWeek' specifies which days, the 
        ' occurrences will occur. in this example, an occurence
        ' will occur every tuesday and another every friday
        ' of every week (since the patterninterval we specified
        ' was 1)
        '
        weekAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Tuesday Or _
                  RecurrencePatternDaysOfWeek.Friday

        weekAppt.Subject = "A weekly recurrence that occurs Tuesday and Friday of every other week."

        ' For a calculated monthly recurrence, the 'PatternDaysOfWeek'
        ' is used in conjuction with the 'PatternInterval' and
        ' and 'PatternOccurrenceOfDayInMonth' to determine which
        ' day of the month will be the start of each occurrence
        '

        ' create a new appointment
        Dim mthAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, dt.AddHours(3D), String.Empty)

        ' create the recurrence object - this appointment
        ' will become the rootappointment (or representation
        ' of the series) - see above for more
        mthAppt.Recurrence = New AppointmentRecurrence()

        ' this will be a monthly recurrence
        mthAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Monthly

        ' the appointment will occur every other month so we specify
        ' a patterninterval of 2
        mthAppt.Recurrence.PatternInterval = 2

        ' to have an appt occur based on a particular pattern (first, second, 
        ' last, etc.) the patterntype must be set to calculated.
        mthAppt.Recurrence.PatternType = RecurrencePatternType.Calculated

        ' then you need to specify the calculatation. in this case, we want 
        ' the last weekday in the month
        mthAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Last
        mthAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekendDays

        ' we could have also specified a particular day
        ' e.g.
        ' appt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday;

        ' the description provides a description of the recurrence info
        mthAppt.Subject = mthAppt.Recurrence.Description


        ' For a calculated yearly recurrence, the 'PatternDaysOfWeek' is
        ' used to determine which day of the month in the year
        ' the occurrences will start.
        '

        ' create a new appointment
        Dim yrAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(DateTime.Today, String.Empty)
        yrAppt.AllDayEvent = True

        ' create the recurrence object - this appointment
        ' will become the rootappointment (or representation
        ' of the series) - see above for more
        yrAppt.Recurrence = New AppointmentRecurrence()

        ' this is a yearly occurrence
        yrAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly

        ' to have an appt occur based on a particular pattern (first, second, 
        ' last, etc.) the patterntype must be set to calculated.
        yrAppt.Recurrence.PatternType = RecurrencePatternType.Calculated

        ' we are creating an appt for hanksgiving, which 
        ' occurs on the 4th thursday of november so we'll
        ' specify a 'PatternMonthOfYear' of 11 for november
        yrAppt.Recurrence.PatternMonthOfYear = 11

        ' its the fourth thursday so specify fourth...
        yrAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Fourth

        ' and it falls on thursday...
        yrAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Thursday

        ' the description provides a description of the recurrence info
        yrAppt.Subject = "Thanksgiving"
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;

		private void CreateRecurringAppointments()
		{
			// The 'PatternDaysOfWeek' is used by weekly, 
			// calculated monthly, calculated yearly and 
			// also daily appointments that occur every
			// weekday.
			//

			// For an every weekday type daily recurrence,
			// the 'PatternDaysOfWeek' is used to specify
			// that the appointment is limited to the
			// weekdays.
			//

			// create a new appointment
			Appointment dailyAppt = this.ultraCalendarInfo1.Appointments.Add(DateTime.Now, DateTime.Now.AddHours(3d), string.Empty);

			// create the recurrence object - this appointment
			// will become the rootappointment (or representation
			// of the series) - it's 'IsRecurringAppointmentRoot'
			// will return true and it will not displayed in 
			// the associated controls. instead, instances or 
			// occurrences of the recurrence will appear in the
			// the controls associated with the calendar info.
			dailyAppt.Recurrence = new AppointmentRecurrence();

			// This will be a daily appointment that will occur
			// each weekday
			dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily;

			// In this case, we use the 'PatternDaysOfWeek' to
			// indicate that the daily occurrences should fall
			// on every weekday (each day but saturday and sunday).
			dailyAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays;

			// assign a subject [not required]
			dailyAppt.Subject = "A daily activity";


			// For a weekly appointment, the 'PatternDaysOfWeek'
			// indicates which days of the week, the occurrences
			// will land upon. e.g. Friday; Monday and Tuesday;
			// all weekdays; all weekend days; etc.
			//

			// create a new appointment
			DateTime dt = DateTime.Now;
			Appointment weekAppt = this.ultraCalendarInfo1.Appointments.Add(dt, dt.AddDays(1d), string.Empty);

			// create the recurrence object - this appointment
			// will become the rootappointment (or representation
			// of the series) - see above for more
			weekAppt.Recurrence = new AppointmentRecurrence();

			// the 'PatternFrequency' indicates the frequency of the recurrence.
			weekAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Weekly;

			// the recurrence should occur every week
			weekAppt.Recurrence.PatternInterval = 1;

			// The 'PatternDaysOfWeek' specifies which days, the 
			// occurrences will occur. in this example, an occurence
			// will occur every tuesday and another every friday
			// of every week (since the patterninterval we specified
			// was 1)
			//
			weekAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Tuesday |
				RecurrencePatternDaysOfWeek.Friday;

			weekAppt.Subject = "A weekly recurrence that occurs Tuesday and Friday of every other week.";

			// For a calculated monthly recurrence, the 'PatternDaysOfWeek'
			// is used in conjuction with the 'PatternInterval' and
			// and 'PatternOccurrenceOfDayInMonth' to determine which
			// day of the month will be the start of each occurrence
			//

			// create a new appointment
			Appointment mthAppt = this.ultraCalendarInfo1.Appointments.Add(dt, dt.AddHours(3d), string.Empty);

			// create the recurrence object - this appointment
			// will become the rootappointment (or representation
			// of the series) - see above for more
			mthAppt.Recurrence = new AppointmentRecurrence();

			// this will be a monthly recurrence
			mthAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Monthly;

			// the appointment will occur every other month so we specify
			// a patterninterval of 2
			mthAppt.Recurrence.PatternInterval = 2;

			// to have an appt occur based on a particular pattern (first, second, 
			// last, etc.) the patterntype must be set to calculated.
			mthAppt.Recurrence.PatternType = RecurrencePatternType.Calculated;
			
			// then you need to specify the calculatation. in this case, we want 
			// the last weekday in the month
			mthAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Last;
			mthAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekendDays;

			// we could have also specified a particular day
			// e.g.
			// appt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday;

			// the description provides a description of the recurrence info
			mthAppt.Subject = mthAppt.Recurrence.Description;


			// For a calculated yearly recurrence, the 'PatternDaysOfWeek' is
			// used to determine which day of the month in the year
			// the occurrences will start.
			//

			// create a new appointment
			Appointment yrAppt = this.ultraCalendarInfo1.Appointments.Add(DateTime.Today, string.Empty);
			yrAppt.AllDayEvent = true;

			// create the recurrence object - this appointment
			// will become the rootappointment (or representation
			// of the series) - see above for more
			yrAppt.Recurrence = new AppointmentRecurrence();

			// this is a yearly occurrence
			yrAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly;

			// to have an appt occur based on a particular pattern (first, second, 
			// last, etc.) the patterntype must be set to calculated.
			yrAppt.Recurrence.PatternType = RecurrencePatternType.Calculated;

			// we are creating an appt for hanksgiving, which 
			// occurs on the 4th thursday of november so we'll
			// specify a 'PatternMonthOfYear' of 11 for november
			yrAppt.Recurrence.PatternMonthOfYear = 11;

			// its the fourth thursday so specify fourth...
			yrAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Fourth;

			// and it falls on thursday...
			yrAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Thursday;

			// the description provides a description of the recurrence info
			yrAppt.Subject = "Thanksgiving";
		}
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