Version

PatternType Property (AppointmentRecurrence)

Gets/sets whether the recurrence pattern is based on a specific day of the month and/or month of the year, or if it is calculated based on other criteria.
Syntax
'Declaration
 
Public Overrides Property PatternType As RecurrencePatternType
public override RecurrencePatternType PatternType {get; set;}
Remarks

Note: The PatternType property is only applicable when the PatternFrequency property is set to 'Monthly' or 'Yearly'.

Example
The following example demonstrates how to use the 'PatternType' to create explicit and calculated recurring appointments.

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

Private Sub CreateExplicitAndCalculatedRecurrences()
    ' The 'PatternType' is used by monthly and yearly 
    ' recurrences to determine whether the occurrences 
    ' will occur on a specific day (i.e. explicit) or
    ' a relative day (i.e. calculated). The default
    ' pattern type is explicit.
    '

    ' A monthly recurrence will occur either on a
    ' specific day number of every x number of months
    ' or it will need to be calculated and will occur
    ' relative to the specified occurence days of
    ' week and day in month pattern.
    '
    ' For a calculated monthly recurrence (i.e. 'PatternType'
    ' == Calculated), the 'PatternInterval' is used in 
    ' conjuction with the 'PatternDaysOfWeek' and 
    ' 'PatternOccurrenceOfDayInMonth'  to determine which 
    ' day of the month will be the start of each occurrence
    '

    ' create a new appointment
    Dim dt As DateTime = DateTime.Now
    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) - 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.
    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.AllWeekdays

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

    mthAppt.Subject = "Occurs the last weekday of every other month"

    ' For an explicit monthly recurrence (i.e. PatternType ==
    ' Explicit), the 'PatternInterval' and 'PatternDayOfMonth'
    ' are used to determine when the occurrences begin
    '

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

    ' see above
    mthAppt2.Recurrence = New AppointmentRecurrence()

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

    ' the appointment will occur every month so we specify
    ' a patterninterval of 1
    mthAppt2.Recurrence.PatternInterval = 1

    ' the occurrences should start on the 
    mthAppt2.Recurrence.PatternDayOfMonth = 15

    ' since we are specifying that the occurences should fall
    ' on a specific day of the month, we are using an explicit
    ' pattern. since this is the default, we don't need to
    ' set the PatternType
    'mthAppt2.Recurrence.PatternType = RecurrencePatternType.Explicit;
    mthAppt2.Subject = "A monthly appointment that occurs on the 15th day of every month"


    ' A yearly recurrence will occur either on a specific
    ' day of a specific month (explicit pattern type) or
    ' on a specific month where the day in the month
    ' is calculated based on the specified day of week
    ' and day in month pattern.
    '
    ' For a calculated yearly recurrence (i.e. PatternType ==
    ' Calculated), the 'PatternDaysOfWeek',
    ' 'PatternOccurrenceOfDayInMonth' and 'PatternMonthOfYear'
    ' are used to determine when each occurrence will begin.
    '

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

    ' see above
    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
    yrAppt.Subject = "Thanksgiving"

    ' For an explicit yearly recurrence (i.e. PatternType ==
    ' Explicit), the 'PatternDayOfMonth' and 'PatternMonthOfYear'
    ' are used to determine when each occurrence begins.
    '

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

    ' see above
    yrAppt2.Recurrence = New AppointmentRecurrence()

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

    ' a yearly recurring appt can have an explicit 
    ' dt pattern - e.g. the 25th of every december
    yrAppt2.Recurrence.PatternMonthOfYear = 12
    yrAppt2.Recurrence.PatternDayOfMonth = 25

    ' its not necessary to set the patterntype in this case
    ' since explicit is the default
    'yrAppt2.Recurrence.PatternType = RecurrencePatternType.Explicit;
    yrAppt2.Subject = "Christmas"

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

		private void CreateExplicitAndCalculatedRecurrences()
		{
			// The 'PatternType' is used by monthly and yearly 
			// recurrences to determine whether the occurrences 
			// will occur on a specific day (i.e. explicit) or
			// a relative day (i.e. calculated). The default
			// pattern type is explicit.
			//

			// A monthly recurrence will occur either on a
			// specific day number of every x number of months
			// or it will need to be calculated and will occur
			// relative to the specified occurence days of
			// week and day in month pattern.
			//
			#region Monthly

			// For a calculated monthly recurrence (i.e. 'PatternType'
			// == Calculated), the 'PatternInterval' is used in 
			// conjuction with the 'PatternDaysOfWeek' and 
			// 'PatternOccurrenceOfDayInMonth'  to determine which 
			// day of the month will be the start of each occurrence
			//

			// create a new appointment
			DateTime dt = DateTime.Now;
			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) - 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.
			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.AllWeekdays;

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

			mthAppt.Subject = "Occurs the last weekday of every other month";

			// For an explicit monthly recurrence (i.e. PatternType ==
			// Explicit), the 'PatternInterval' and 'PatternDayOfMonth'
			// are used to determine when the occurrences begin
			//

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

			// see above for more
			mthAppt2.Recurrence = new AppointmentRecurrence();

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

			// the appointment will occur every month so we specify
			// a patterninterval of 1
			mthAppt2.Recurrence.PatternInterval = 1;

			// the occurrences should start on the 
			mthAppt2.Recurrence.PatternDayOfMonth = 15;

			// since we are specifying that the occurences should fall
			// on a specific day of the month, we are using an explicit
			// pattern. since this is the default, we don't need to
			// set the PatternType
			//mthAppt2.Recurrence.PatternType = RecurrencePatternType.Explicit;
			
			mthAppt2.Subject = "Occurs on the 15th day of every month";

			#endregion //Monthly


			// A yearly recurrence will occur either on a specific
			// day of a specific month (explicit pattern type) or
			// on a specific month where the day in the month
			// is calculated based on the specified day of week
			// and day in month pattern.
			//
			#region Yearly

			// For a calculated yearly recurrence (i.e. PatternType ==
			// Calculated), the 'PatternDaysOfWeek',
			// 'PatternOccurrenceOfDayInMonth' and 'PatternMonthOfYear'
			// are used to determine when each occurrence will begin.
			//

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

			// 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;

			yrAppt.Subject = "Thanksgiving";

			// For an explicit yearly recurrence (i.e. PatternType ==
			// Explicit), the 'PatternDayOfMonth' and 'PatternMonthOfYear'
			// are used to determine when each occurrence begins.
			//

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

			// see above for more
			yrAppt2.Recurrence = new AppointmentRecurrence();

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

			// a yearly recurring appt can have an explicit 
			// dt pattern - e.g. the 25th of every december
			yrAppt2.Recurrence.PatternMonthOfYear = 12;
			yrAppt2.Recurrence.PatternDayOfMonth = 25;

			// its not necessary to set the patterntype in this case
			// since explicit is the default
			//yrAppt2.Recurrence.PatternType = RecurrencePatternType.Explicit;

			yrAppt2.Subject = "Christmas";

			#endregion //Yearly
		}
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