Appointments

Creating an Appointment

RadCalendar can display appointments by setting its AppointmentsSource property. It accepts a collection of objects which should implement Telerik.XamarinForms.Input.IAppointment interface. This interface defines the following members:

  • StartDate (DateTime)
  • EndDate (DateTime)
  • Title (string)
  • Detail (string)
  • Color (Color)
  • IsAllDay (bool)

With R1 2019 release of Telerik UI for Xamarin we have introduced Telerik.XamarinForms.Input.Appointment class which implements the IAppointment interface as well as adds RecurrenceRule property to support recurrence feature. We'd recommend you use directly the Appointment class when working with appointments.

var date = DateTime.Today;

var calendar = new RadCalendar
{
    DisplayDate = date,  
    AppointmentsSource = new List<Appointment> {
        new Appointment {
            Title = "Meeting with Tom",
            Detail = "Sea Garden",
            StartDate = date.AddHours(10),
            EndDate = date.AddHours(11),
            Color = Color.Tomato
        },
        new Appointment {
            Title = "Lunch with Sara",
            Detail = "Restaurant",
            StartDate = date.AddHours(12).AddMinutes(30),
            EndDate = date.AddHours(14),
            Color = Color.DarkTurquoise
        },
        new Appointment {
            Title = "Elle Birthday",
            StartDate = date.AddDays(1),
            EndDate = date.AddDays(1).AddHours(12),
            IsAllDay = true
        },
         new Appointment {
            Title = "Football Game",
            StartDate = date.AddDays(2).AddHours(15),
            EndDate = date.AddDays(2).AddHours(17),
            Color = Color.Green
        }
    }
};

Figure 1: Appearance of the RadCalendar control in month view mode

Appointments monthview

Figure 2: Appearance of the RadCalendar control in day view mode

Appointments dayview

Events

AppointmentTapped(AppointmentTappedEventArgs): Occurs when you tap over a specific appointment when in DayView or MultiDayView mode. It can be used to get all the information regarding the appointment.

AppointmentTapped Example

First you need to set the ViewMode to Day:

calendar.ViewMode = CalendarViewMode.Day;

Eventually, you can utilize the event:

calendar.AppointmentTapped += (sender, e) =>
{
    Application.Current.MainPage.DisplayAlert(e.Appointment.Title, e.Appointment.Detail, "OK");
};

See Also

In this article
Not finding the help you need? Improve this article