Implementing View-ViewModel
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
- Create a new class named MyViewModel.
In the MyViewModel class add two properties:
Appointments - we will bind the AppointmentsSource property of the RadScheduleView to this property.
ResourcesTypes - we will bind the ResourceTypesSource property of the RadScheduleView to this property.
- Let's create a method in the ViewModel that generates some Resources:
- All we have to do is to initialize the resourceTypes and appointments fields:
- The ViewModel is complete. Now, let's return to the View. Add some ViewDefinitions, GroupDescriptionsSource and bind the AppointmentsSource and ResourceTypes
- Finally, set the DataContext: