New to Telerik UI for WinForms? Start a free 30-day trial

Represents a weekly recurrence rule.

Definition

Constructors

Initializes a new instance of the WeeklyRecurrenceRule class.

C#
public WeeklyRecurrenceRule()

Initializes a new instance of the WeeklyRecurrenceRule class.

C#
public WeeklyRecurrenceRule(DateTime start, DateTime end, WeekDays weekdays, int interval, int count)
Parameters:startDateTime

The start of the recurrence rule.

endDateTime

The end of the recurrence rule.

weekdaysWeekDays

The week days.

intervalint

The interval of the recurrence rule.

countint

The count.

Initializes a new instance of the WeeklyRecurrenceRule class.

C#
public WeeklyRecurrenceRule(DateTime start, DateTime end, WeekDays weekdays, int interval)
Parameters:startDateTime

The start of the recurrence rule.

endDateTime

The end of the recurrence rule.

weekdaysWeekDays

The week days.

intervalint

The interval of the recurrence rule.

Initializes a new instance of the WeeklyRecurrenceRule class.

C#
public WeeklyRecurrenceRule(DateTime start, WeekDays weekdays, int interval, int count)
Parameters:startDateTime

The start of the recurrence rule.

weekdaysWeekDays

The week days.

intervalint

The interval of the recurrence rule.

countint

The count.

Initializes a new instance of the WeeklyRecurrenceRule class.

C#
public WeeklyRecurrenceRule(DateTime start, WeekDays weekdays, int interval)
Parameters:startDateTime

The start of the recurrence rule.

weekdaysWeekDays

The week days.

intervalint

The interval of the recurrence rule.

Fields

The default offset, which does not apply an ordinal weekday filter.

C#
public static readonly int DefaultOffset

The positive- or negative-offset matcher selected when Offset is set.

C#
protected WeeklyRecurrenceRule.MatchOffsetDelegate MatchOffset

Properties

Gets or sets the first day used to group dates into weeks; null uses the culture's setting.

C#
public DayOfWeek? FirstDayOfWeek { get; set; }

Gets the type of the recurrence rule.

C#
public override RecurrenceType Frequency { get; }
Property Value:

The type of the recurrence rule.

Overrides: RecurrenceRule.Frequency

Gets or sets the offset.

C#
public int Offset { get; set; }
Property Value:

The offset.

Gets or sets the week days.

C#
public WeekDays WeekDays { get; set; }
Property Value:

The week days.

Methods

Determines whether the rule's weekday mask includes all of the specified weekdays.

C#
public bool AreWeekDaysIncluded(WeekDays days)
Parameters:daysWeekDays

The weekdays to test.

Returns:

bool

true when every specified weekday is included; otherwise, false.

Copies the base recurrence settings, weekday mask, and offset to another rule. FirstDayOfWeek is not copied, and a copied nonzero offset does not initialize MatchOffset.

C#
protected override void CopyProperties(RecurrenceRule other)
Parameters:otherRecurrenceRule

The rule that receives the copied properties.

Overrides: RecurrenceRule.CopyProperties(RecurrenceRule)

Creates a new instance of the concrete rule type for use by Clone().

C#
protected override RecurrenceRule CreateInstance()
Returns:

RecurrenceRule

A new instance of the concrete recurrence-rule type.

Overrides: RecurrenceRule.CreateInstance()

Compares the weekday mask and offset, then the shared recurrence settings. FirstDayOfWeek is not included in the comparison.

C#
public override bool Equals(RecurrenceRule other)
Parameters:otherRecurrenceRule

The rule to compare with this weekly rule.

Returns:

bool

true when the compared settings are equal; otherwise, false.

Overrides: RecurrenceRule.Equals(RecurrenceRule)

Toggles the specified weekday flags in the rule's mask; flags that were absent become included.

C#
public void ExcludeWeekDays(WeekDays days)
Parameters:daysWeekDays

The weekday flags to toggle.

Resolves the rule's week start, falling back to the supplied culture's first weekday.

C#
protected DayOfWeek GetFirstDayOfWeek(DateTimeFormatInfo dateTimeFormat)
Parameters:dateTimeFormatDateTimeFormatInfo

The culture-specific date information.

Returns:

DayOfWeek

The explicitly configured first weekday, or FirstDayOfWeek when none is set.

Gets the negative-offset boundary; this implementation returns the boundary immediately after the containing week. Derived period rules can override the boundary.

C#
protected virtual DateTime GetNegativeOffsetStart(DateTime date, DateTimeFormatInfo dateTimeFormat)
Parameters:dateDateTime

A date in the week to inspect.

dateTimeFormatDateTimeFormatInfo

Culture-specific calendar information used to determine the week.

Returns:

DateTime

The negative-offset boundary for the period containing date.

Gets the occurrence start given a occurrence index.

C#
public override DateTime GetOccurrenceStart(int index, DateTime startDate, DateTimeFormatInfo dateTimeFormat)
Parameters:indexint

The index.

startDateDateTime

The start of the reccuring series.

dateTimeFormatDateTimeFormatInfo

The date time format.

Returns:

DateTime

Overrides: RecurrenceRule.GetOccurrenceStart(int, DateTime, DateTimeFormatInfo)

Gets the positive-offset start boundary; this implementation uses the beginning of the containing week. Derived period rules can override the boundary.

C#
protected virtual DateTime GetPositiveOffsetStart(DateTime date, DateTimeFormatInfo dateTimeFormat)
Parameters:dateDateTime

A date in the week to inspect.

dateTimeFormatDateTimeFormatInfo

Culture-specific calendar information used to determine the week.

Returns:

DateTime

The start of the week containing date.

Adds the specified weekdays to the rule's weekday mask.

C#
public void IncludeWeekDays(WeekDays days)
Parameters:daysWeekDays

The weekdays to include.

Matches an exception by calendar date, regardless of the events' times or durations.

C#
public override bool IntersectsWithException(DateTime eventStart, TimeSpan eventDuration, IEvent exception)
Parameters:eventStartDateTime

The start of the candidate occurrence.

eventDurationTimeSpan

The candidate occurrence duration; it does not affect date matching.

exceptionIEvent

The exception event to compare with the candidate occurrence.

Returns:

bool

true when both starts fall on the same year and day of year; otherwise, false.

Overrides: RecurrenceRule.IntersectsWithException(DateTime, TimeSpan, IEvent)

Checks whether a date's weekday is selected by the rule's weekday mask. Derived rules can add period-specific constraints.

C#
protected virtual bool IsOffsetMatch(DateTime date, DateTimeFormatInfo dateTimeFormat)
Parameters:dateDateTime

The date to check.

dateTimeFormatDateTimeFormatInfo

Culture-specific calendar information used to resolve its weekday.

Returns:

bool

true when the date matches the weekday mask; otherwise, false.

Checks the interval week and weekday mask, or the start date's weekday when WeekDays is None, then applies the configured positive or negative weekday offset.

C#
public override bool MatchAdvancedPattern(DateTime start, DateTimeFormatInfo dateTimeFormat)
Parameters:startDateTime

The candidate occurrence start.

dateTimeFormatDateTimeFormatInfo

Culture-specific calendar information used to determine week boundaries.

Returns:

bool

true when the candidate matches the weekly pattern; otherwise, false.

Overrides: RecurrenceRule.MatchAdvancedPattern(DateTime, DateTimeFormatInfo)

Tests whether the candidate's calendar weekday is present in the rule's WeekDays mask.

C#
protected bool MatchDayOfWeekMask(DateTime start, Calendar calendar)
Parameters:startDateTime

The candidate date to check.

calendarCalendar

The calendar used to resolve the date's weekday.

Returns:

bool

true when the candidate weekday is selected; otherwise, false.

Counts selected dates after the candidate through the boundary returned by GetNegativeOffsetStart(DateTime, DateTimeFormatInfo).

C#
protected bool MatchOffsetNegative(DateTime date, DateTimeFormatInfo dateTimeFormat)
Parameters:dateDateTime

The candidate date to check.

dateTimeFormatDateTimeFormatInfo

Culture-specific calendar information used for week calculations.

Returns:

bool

true when the negative count matches Offset; otherwise, false.

Counts selected dates from the boundary returned by GetPositiveOffsetStart(DateTime, DateTimeFormatInfo) through the candidate.

C#
protected bool MatchOffsetPositive(DateTime date, DateTimeFormatInfo dateTimeFormat)
Parameters:dateDateTime

The candidate date to check.

dateTimeFormatDateTimeFormatInfo

Culture-specific calendar information used for week calculations.

Returns:

bool

true when the count matches Offset; otherwise, false.