This question is locked. New answers and comments are not allowed.
For planning courses where I have to assign teachers, I will use the RadSchedulerView,
where the calendar from the course and teachers are visible. The calendar of the teachers must be read only!
So I tried to integrate readonly slot for the teachers resources.
Implementation
I've defined a ResourceType 'Calendar' with the Resources 'Course', 'Teacher1' and 'Teacher2'. Added different appointments:
All this is grouped in the RadSchedulerView with DataGroupDescription, ResourceGroupDescription ResourceType="Calendar". That looks very good.
Now I want to make the Resources for 'Teacher1' and 'Teacher2' as readonly. So I defined a readonly slot as proposed in the telerik demos.
But with no success.
To find the problem,I stripped down the code to find the cause - but with no success.
Finally I started with the sample code from Style a read-only slot :
- And added following code in the ctor of the MyViewModel after defining the slot:
- defined the property: public ObservableCollection<ResourceType> ResourceTypes { set; get; }
- and added in the MainPage.xaml following:
When I run that, it will show the three resources grouped, but the defined slot is not showing!
If I remove the line 'ResourceTypesSource="{Binding ResourcesTypes}"', it will show the slot but no more the three resources!
What's wrong?
How can I define a readonly slot for the resource 'Teacher1' and 'Teacher2'?
Idea: assign the teacher resources to the readOnlyslot (readOnlyslot.Resources.Add(resourceTeacher1); ).
Can you post a sample for that?
Regards
Björn.
where the calendar from the course and teachers are visible. The calendar of the teachers must be read only!
So I tried to integrate readonly slot for the teachers resources.
Implementation
I've defined a ResourceType 'Calendar' with the Resources 'Course', 'Teacher1' and 'Teacher2'. Added different appointments:
- 'Course1' => for resource 'Course', 'Teacher1' (the teacher is booked for the course)
- 'Course2' => for resource 'Course'
- 'Private Appoinment' => for resource 'Teacher2' (so during that time, he cannot be booked for the course)
All this is grouped in the RadSchedulerView with DataGroupDescription, ResourceGroupDescription ResourceType="Calendar". That looks very good.
Now I want to make the Resources for 'Teacher1' and 'Teacher2' as readonly. So I defined a readonly slot as proposed in the telerik demos.
But with no success.
To find the problem,I stripped down the code to find the cause - but with no success.
Finally I started with the sample code from Style a read-only slot :
- And added following code in the ctor of the MyViewModel after defining the slot:
ResourcesTypes = new ObservableCollection<ResourceType>();var resourceTypeCalendar = new ResourceType("Calendar");ResourcesTypes.Add(resourceTypeCalendar);// calendar for course appointmentsvar resourceCourse = new Resource("Course");resourceTypeCalendar.Resources.Add(resourceCourse);// calendar for course appointmentsvar resourceTeacher1 = new Resource("Teacher1");resourceTypeCalendar.Resources.Add(resourceTeacher1);// calendar for course appointmentsvar resourceTeacher2 = new Resource("Teacher1");resourceTypeCalendar.Resources.Add(resourceTeacher2);var today = DateTime.Today;var appointment = new Appointment();appointment.UniqueId = Guid.NewGuid().ToString();appointment.Subject = "Course1";appointment.Start = today.AddHours(9);appointment.End = appointment.Start.AddHours(2);// appointment from course & teacher2appointment.Resources.Add(resourceCourse);appointment.Resources.Add(resourceTeacher1);Appointments.Add(appointment);appointment = new Appointment();appointment.UniqueId = Guid.NewGuid().ToString();appointment.Subject = "Course2";appointment.Start = today.AddDays(2).AddHours(8);appointment.End = appointment.Start.AddHours(4);// appointment from courseappointment.Resources.Add(resourceCourse);Appointments.Add(appointment);appointment = new Appointment();appointment.UniqueId = Guid.NewGuid().ToString();appointment.Subject = "Private Appoinment";appointment.Start = today.AddDays(2).AddHours(7);appointment.End = appointment.Start.AddHours(8);// appointment from teacher2appointment.Resources.Add(resourceTeacher2);Appointments.Add(appointment);- defined the property: public ObservableCollection<ResourceType> ResourceTypes { set; get; }
- and added in the MainPage.xaml following:
<telerik:RadScheduleView AppointmentsSource="{Binding Appointments}" ResourceTypesSource="{Binding ResourcesTypes}" SpecialSlotsSource="{Binding SpecialSlots}" SpecialSlotStyleSelector="{StaticResource SpecialSlotStyleSelector}"> <telerik:RadScheduleView.ViewDefinitions> <telerik:WeekViewDefinition /> </telerik:RadScheduleView.ViewDefinitions> <telerik:RadScheduleView.GroupDescriptionsSource> <telerik:GroupDescriptionCollection> <telerik:DateGroupDescription /> <telerik:ResourceGroupDescription ResourceType="Calendar" /> </telerik:GroupDescriptionCollection> </telerik:RadScheduleView.GroupDescriptionsSource></telerik:RadScheduleView>When I run that, it will show the three resources grouped, but the defined slot is not showing!
If I remove the line 'ResourceTypesSource="{Binding ResourcesTypes}"', it will show the slot but no more the three resources!
What's wrong?
How can I define a readonly slot for the resource 'Teacher1' and 'Teacher2'?
Idea: assign the teacher resources to the readOnlyslot (readOnlyslot.Resources.Add(resourceTeacher1); ).
Can you post a sample for that?
Regards
Björn.