Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
xamSchedule Monthly Recurrent Activities
posted

I have been following the documentation from http://help.infragistics.com/Help/Doc/WPF/2015.1/CLR4.0/html/xamSchedule_Using_Activities_Recurrent.html#Example_CS on how to create recurrent activities.

I haven't found any examples on how to create custom monthly activities.

Say for example I have these parameters:

Parameter 1: First, Second, Third, Forth, Last

Parameter 2: day, weekday, weekday day, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday

How would I create a recurrence for:

  • First day of every month

or

  • Third Friday of every month

or

  • Last Weekday of every month

TIA

Parents
No Data
Reply
  • 1530
    Verified Answer
    posted

    Hi reggie,

    Thank you for your post. You can create custom monthly recurrences like this:

     DateRecurrence rec = new DateRecurrence();
                rec.Count = 10;
                rec.Frequency = DateRecurrenceFrequency.Monthly;
                rec.Interval = 1;
                var recuRules = new List<DateRecurrenceRuleBase>();
                rec.Rules.Add(new DayOfWeekRecurrenceRule(DayOfWeek.Monday, 0));
                rec.Rules.Add(new DayOfWeekRecurrenceRule(DayOfWeek.Tuesday, 0));
                rec.Rules.Add(new DayOfWeekRecurrenceRule(DayOfWeek.Wednesday, 0));
                rec.Rules.Add(new DayOfWeekRecurrenceRule(DayOfWeek.Thursday, 0));
                rec.Rules.Add(new DayOfWeekRecurrenceRule(DayOfWeek.Friday, 0));
                rec.Rules.Add(new DayOfWeekRecurrenceRule(DayOfWeek.Saturday, 0));
                rec.Rules.Add(new DayOfWeekRecurrenceRule(DayOfWeek.Sunday, 0));
                rec.Rules.Add(new SubsetRecurrenceRule { OccurrenceInstance = -1 });
                myReccAppointment.Recurrence = rec;
    
    

    Parameter 1: First, Second, Thirds, Fourth, Last is determined from the SubsetReccurenceRule's OccurenceInstance. Valid values are 1 to 366 and -366 to -1 where negative values indicate nth to the last.

    Parameter 2: day, weekday, ....etc is determined from the DayOfWeekReccurenceRule's DayOfWeek that you are adding. For instance the provided sample demonstrates a Monthly recurrence Last Day every 1 month. You can review the attached sample as well and if you have any questions do not hesitate to ask.

    Thanks, Teodor
    Software Developer
    www.infragistics.com

    xamSchedule_MonthlyRecurrence.zip
Children