The PatternInterval property works in conjunction with the PatternFrequency property to determine the cycle of the recurrence. For example, if the PatternFrequency is set to 'Daily', and the PatternInterval is set to 2, the recurrence occurs every other day.
Note: The PatternInterval property is not applicable when the PatternFrequency property is set to 'Yearly'. Also note that the maximum allowable value for the PatternInterval property is 99.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics Private Sub CreateRecurringAppointmentsWithIntervals() ' The 'PatternInterval' is used by all pattern ' frequency's except Yearly. ' ' For a daily recurrence, the PatternInterval is ' used to specify the number of days between ' each occurrence. ' ' create a new appointment Dim dt As DateTime = DateTime.Now Dim dailyAppt 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. dailyAppt.Recurrence = New AppointmentRecurrence() ' This will be a daily recurrence that will occur ' each weekday dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily ' The PatternInterval indicates how many days passes between the ' start of each occurrence in the series. In this example, ' an occurrence will occur every 3 days. ' dailyAppt.Recurrence.PatternInterval = 3 ' assign a subject [not required] dailyAppt.Subject = "A daily activity that occurs every 3 days" ' For a weekly recurrence, the PatternInterval ' is used to specify the number of weeks ' between the occurrences. ' ' create a new appointment Dim weekAppt As Appointment = Me.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 PatternInterval is used to indicate the number of ' weeks between the appointment occurs. In this example, ' the appointment will be on tuesday and thursday of ' every other week. weekAppt.Recurrence.PatternInterval = 2 ' The 'PatternDaysOfWeek' specifies which days, the ' occurrences will occur. in this example, an occurence ' will occur every tuesday and another every friday ' of every other week weekAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Tuesday Or _ RecurrencePatternDaysOfWeek.Friday weekAppt.Subject = "A weekly recurrence that occurs Tuesday and Friday of every other week." ' For a monthly recurrence, the PatternInterval ' is used by both explicit and calculated to ' specify the number of months between each ' occurrence. ' ' 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.AllWeekdays ' we could have also specified a particular day ' e.g. ' appt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday; ' set the subject to provide a description of the recurrence info ' this will be the subject of all the occurrences until they ' are modified to become a variance. mthAppt.Subject = "A monthly recurrence that occurs the last weekday of every other month" ' For an explicit monthly recurrence, 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) ' create the recurrence object - this appointment ' will become the rootappointment (or representation ' of the series) - 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; ' the subject will be the default subject for all occurrences ' but can be changed by creating a variance. to do that you need ' to get a specific occurrence and modify one of its values mthAppt2.Subject = "A monthly appointment that occurs on the 15th day of every month" End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; private void CreateRecurringAppointmentsWithIntervals() { // The 'PatternInterval' is used by all pattern // frequency's except Yearly. // // For a daily recurrence, the PatternInterval is // used to specify the number of days between // each occurrence. // #region Daily // create a new appointment DateTime dt = DateTime.Now; Appointment dailyAppt = 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. dailyAppt.Recurrence = new AppointmentRecurrence(); // This will be a daily recurrence that will occur // each weekday dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily; // The PatternInterval indicates how many days passes between the // start of each occurrence in the series. In this example, // an occurrence will occur every 3 days. // dailyAppt.Recurrence.PatternInterval = 3; // assign a subject [not required] dailyAppt.Subject = "A daily activity that occurs every 3 days"; #endregion //Daily // For a weekly recurrence, the PatternInterval // is used to specify the number of weeks // between the occurrences. // #region Weekly // create a new appointment 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 PatternInterval is used to indicate the number of // weeks between the appointment occurs. In this example, // the appointment will be on tuesday and thursday of // every other week. weekAppt.Recurrence.PatternInterval = 2; // The 'PatternDaysOfWeek' specifies which days, the // occurrences will occur. in this example, an occurence // will occur every tuesday and another every friday // of every other week weekAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Tuesday | RecurrencePatternDaysOfWeek.Friday; weekAppt.Subject = "A weekly recurrence that occurs Tuesday and Friday of every other week."; #endregion //Weekly // For a monthly recurrence, the PatternInterval // is used by both explicit and calculated to // specify the number of months between each // occurrence. // #region Monthly // 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.AllWeekdays; // we could have also specified a particular day // e.g. // appt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday; // set the subject to provide a description of the recurrence info // this will be the subject of all the occurrences until they // are modified to become a variance. mthAppt.Subject = "A monthly recurrence that occurs the last weekday of every other month"; // For an explicit monthly recurrence, 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); // create the recurrence object - this appointment // will become the rootappointment (or representation // of the series) - 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; // the subject will be the default subject for all occurrences // but can be changed by creating a variance. to do that you need // to get a specific occurrence and modify one of its values mthAppt2.Subject = "A monthly appointment that occurs on the 15th day of every month"; #endregion //Monthly }
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