New to Telerik UI for .NET MAUI? Start a free 30-day trial
Appointments
Telerik UI for .NET MAUI Scheduler control allows you to display appointments by setting its AppointmentsSource
property. AppointmentsSource
accepts a collection of Appointment
objects. Each Appointment
defines the following properties:
Start
—Defines the value determining the start date and time of the аppointment.End
—Defines the value that determining the end date and time of the appointment.Subject
—Defines the value that indicates the subject of the appointmentIsAllDay
—Indicates whether the appointment will take all day.RecurrenceRule
—Defines basic properties of the recurrence rule of the appointment, for more details go to Recurrence topic.
Here is a quick example on how you can create Appointments collection and bind it to the AppointmentsSource
property of RadScheduler
.
1. First, create a ViewModel class and add "Appointments" collection inside it:
c#
public class ViewModel
{
public ViewModel()
{
var date = DateTime.Today;
this.Appointments = new ObservableCollection<Appointment>
{
new Appointment {
Subject = "Meeting with Tom",
Start = date.AddHours(10),
End = date.AddHours(11)
},
new Appointment {
Subject = "Lunch with Sara",
Start = date.AddHours(12).AddMinutes(30),
End = date.AddHours(14)
},
new Appointment {
Subject = "Elle Birthday",
Start = date,
End = date.AddHours(11),
IsAllDay = true
},
new Appointment {
Subject = "Football Game",
Start = date.AddDays(2).AddHours(15),
End = date.AddDays(2).AddHours(17)
}
};
}
public ObservableCollection<Appointment> Appointments { get; set; }
}
2. Add the RadScheduler
definition to the page:
xaml
<telerik:RadScheduler x:Name="scheduler" AppointmentsSource="{Binding Appointments}">
<telerik:RadScheduler.ViewDefinitions>
<telerik:WeekViewDefinition />
<telerik:WeekViewDefinition Title="Work Week" IsWeekendVisible="False" />
<telerik:MultidayViewDefinition VisibleDays="3" Title="3 Day" />
<telerik:MonthViewDefinition />
<telerik:DayViewDefinition />
</telerik:RadScheduler.ViewDefinitions>
</telerik:RadScheduler>
3. The last step is to set the ViewModel as a BindingContext:
c#
this.BindingContext = new ViewModel();
The image below shows the appointments in WeekView: