New to Telerik UI for WinUI? Download free 30-day trial

Filtering

The RadScheduler control enables you to filter its appointments and individual occurrences by passing a predicate to a view definition's AppointmentFilter and OccurrenceFilter properties. While the AppointmentFilter will filter out the appointments which fulfil the predicate's condition, the OccurrenceFilter will check each individual occurence (including exceptions) of an recurring appointment.

AppointmentFilter

The following filter will exclude all appointments whose start date is not today.

Example 1: Define the appointments filter predicate

public Predicate<IAppointment> AppointmentsFilter 
{ 
    get { return Filter; } 
} 
 
public bool Filter(IAppointment appointment) 
{ 
    var app = appointment as Appointment; 
    return app != null && TodaysAppointments(app); 
} 
 
public bool TodaysAppointments(Appointment app) 
{ 
    return app != null && app.Start.Date == DateTime.Today; 
} 

Example 2: Set a definition's AppointmentFilter property

<telerik:WeekViewDefinition AppointmentFilter="{Binding AppointmentFilter}"/> 

OccurenceFilter

The filter demonstrated in examples 3 and 4 will exclude all occurences whose total duration is more than one hour.

The OccurenceFilter is useful when you need to exclude only certain occurrences/exceptions of any recurring appointment.

Example 3: Define the occurences filter predicate

public Predicate<IOccurrence> OccurenceFilter 
{ 
    get { return Filter; } 
} 
 
public bool Filter(IOccurrence occurance) 
{ 
    var occ = occurance as Occurrence; 
    return occ != null && IsOccurenceShort(occ); 
} 
 
public bool IsOccurenceShort(Occurrence occ) 
{ 
    return (occ.End - occ.Start) <= TimeSpan.FromHours(1); 
} 

Example 4: Set a definition's AppointmentFilter property

<telerik:DayViewDefinition OccurrenceFilter="{Binding OccurenceFilter}"/> 

See Also

In this article
Not finding the help you need?