Telerik UI for Windows Phone by Progress

RadCalendar can display appointments in its month view by using its AppointmentsSource property.

Calendar With Appointments

The appointments source is defined as a new class that inherits from the base abstract class Telerik.Windows.Controls.AppointmentSource. By using this base class developers are able to display appointments from any source – phone device, their own web service or a third party appointments data. Here is a simple implementation of sample appointments source:

CopyC#
public class SampleAppointmentSource : AppointmentSource
{
    public SampleAppointmentSource()
    {
    }

    public override void FetchData(DateTime startDate, DateTime endDate)
    {
        this.AllAppointments.Clear();
        this.AllAppointments.Add(new SampleAppointment()
        {
            StartDate = DateTime.Now,
            EndDate = DateTime.Now.AddHours(1),
            Subject = "Today Appointment 1",
            Details = "Some Long Details are coming here",
            Location = "My Home Town"
        });
        this.AllAppointments.Add(new SampleAppointment()
        {
            StartDate = DateTime.Now.AddMinutes(30),
            EndDate = DateTime.Now.AddHours(1),
            Subject = "Today Appointment 2",
            Details = "Some Long Details are coming here",
            Location = "Paris"
        });
        this.OnDataLoaded(); // notify that there is new data to display
    }
}

Here is and how the SampleAppointment looks like:

CopyC#
public class SampleAppointment : IAppointment
{
    /// <summary> 
    /// Gets the details of the appointment. 
    /// </summary> 
    public string Details
    {
        get;
        set;
    }

    /// <summary> 
    /// Gets the end date and time of the appointment. 
    /// </summary> 
    public DateTime EndDate
    {
        get;
        set;
    }

    /// <summary> 
    /// Gets the location of the appointment. 
    /// </summary> 
    public string Location
    {
        get;
        set;
    }

    /// <summary> 
    /// Gets the start date and time of the appointment. 
    /// </summary> 
    public DateTime StartDate
    {
        get;
        set;
    }

    /// <summary> 
    /// Gets the subject of the appointment. 
    /// </summary> 
    public string Subject
    {
        get;
        set;
    }

    /// <summary> 
    /// Gets a string representation of the appointment 
    /// </summary> 
    /// <returns>A string representation of the appointment</returns> 
    public override string ToString()
    {
        return this.Subject;
    }
}

Please note that the appointment should implement the Telerik.Windows.Controls.IAppointment interface.

Once we have the appointments source declared we just need to set it to RadCalendar:

CopyC#
RadCalendar1.AppointmentSource = new SampleAppointmentSource();

As you can see it is pretty straightforward process in implementing an arbitrary appointment source. The FetchData method needs to be overridden and the OnDataLoaded method should be called once the data is loaded, so that the consumers of this data source (like RadCalendar) can be notified when new data is available.