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

Implementing View-ViewModel

Updated on Sep 23, 2026

The purpose of this tutorial is to show you how to bind a RadScheduleView with a ViewModel.

Before reading this tutorial you should get familiar with the Data Binding support of the RadScheduleView control.

  • Add a new RadScheduleView declaration in your XAML
XAML
<telerik:RadScheduleView />
  • Create a new class named MyViewModel.
C#
public class MyViewModel
{
}
  • In the MyViewModel class add two properties:
  1. Appointments - we will bind the AppointmentsSource property of the RadScheduleView to this property.

  2. ResourcesTypes - we will bind the ResourceTypesSource property of the RadScheduleView to this property.

C#
private ObservableCollection<Appointment> appointments;
private ObservableCollection<ResourceType> resourceTypes;
public ObservableCollection<Appointment> Appointments
{
    get
    {
        return this.appointments;
    }
    set
    {
        this.appointments = value;
    }
}
public ObservableCollection<ResourceType> ResourcesTypes
{
    get
    {
        return this.resourceTypes;
    }
    set
    {
        this.resourceTypes = value;
    }
}
  • Let's create a method in the ViewModel that generates some Resources:
C#
private ObservableCollection<ResourceType> GenerateResourceTypes()
{
    ObservableCollection<ResourceType> result = new ObservableCollection<ResourceType>();

    ResourceType roomType = new ResourceType("Room");
    Resource room102 = new Resource("Room 102");
    Resource room203 = new Resource("Room 203");
    Resource room406 = new Resource("Room 406");
    roomType.Resources.Add(room102);
    roomType.Resources.Add(room203);
    roomType.Resources.Add(room406);

    ResourceType speakerType = new ResourceType("Speaker");
    Resource tomSpeaker = new Resource("Tom");
    Resource peterSpeaker = new Resource("Peter");
    speakerType.Resources.Add(tomSpeaker);
    speakerType.Resources.Add(peterSpeaker);

    result.Add(roomType);
    result.Add(speakerType);
    return result;
}
  • All we have to do is to initialize the resourceTypes and appointments fields:
C#
public void SetData()
{
    this.resourceTypes = this.GenerateResourceTypes();
    this.appointments = new ObservableCollection<Appointment>();
}
  • The ViewModel is complete. Now, let's return to the View. Add some ViewDefinitions, GroupDescriptionsSource and bind the AppointmentsSource and ResourceTypes
XAML
<telerik:RadScheduleView AppointmentsSource="{Binding Appointments}" 
	                         ResourceTypesSource="{Binding ResourcesTypes}" xmlns:scheduleView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.ScheduleView">
    <telerik:RadScheduleView.ViewDefinitions>
        <telerik:DayViewDefinition />
        <telerik:WeekViewDefinition />
        <telerik:TimelineViewDefinition />
    </telerik:RadScheduleView.ViewDefinitions>
    <telerik:RadScheduleView.GroupDescriptionsSource>
        <scheduleView:GroupDescriptionCollection>
            <scheduleView:DateGroupDescription />
            <scheduleView:ResourceGroupDescription ResourceType="Speaker" />
            <scheduleView:ResourceGroupDescription ResourceType="Room" />
        </scheduleView:GroupDescriptionCollection>
    </telerik:RadScheduleView.GroupDescriptionsSource>
</telerik:RadScheduleView>
  • Finally, set the DataContext:
C#
this.DataContext = new MyViewModel();

See Also

In this article
See Also
Not finding the help you need?
Contact Support