ScheduleView change AppointmentResource in code behind

1 Answer 30 Views
ScheduleView
Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
Benedikt asked on 26 Nov 2021, 12:47 PM

Hi guys,

We are currently trying the RadScheduleView and want to display appointments. These appointments can change from another user, so we reload the data from time to time.
The Appointments are bound to a observable Collection, so adding and removing items should be easy. 

The problem is, that after the inital load we cant change the collection. We get the error it has to be in the same thread.
It doesnt' matter if we use a dispatcher or not.
And even if we set the SourceBinding to null before its the same error.

 

We attached a sample project without database. If you cklick the Button on top of the window you will get the error.

 

Does anyone hav an idea to solve the problem,. or maybe load the data in another way so it can be changed from code behind?

 

Greetings.

1 Answer, 1 is accepted

Sort by
1
Accepted
Dilyan Traykov
Telerik team
answered on 01 Dec 2021, 08:29 AM

Hi Benedikt,

Thank you for the provided project and image.

I was able to trace the exception to the following line which I have commented out:

                foreach (clsPhase phase in projekt.phasen)
                {
                    Resource r = new Resource() { ResourceType = "Projekte", ResourceName = projekt.projektleiterkrzl + projekt.id.ToString() };
                    //phase.Resources.Add(r);

                    Appointments.Add(phase);
                }

As it is a rather large project I'm unable to interpret the exact purpose of the DisplayAppointments method. Can you please clarify why you create a new resource for each phase and whether this is expected? I assume that instead, you need to use one of the already created resources and assign this to the appointment but I cannot be certain at this point.

Thank you in advance for any clarifications you can provide.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ScheduleView
Asked by
Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Dilyan Traykov
Telerik team
Share this question
or