This is a migrated thread and some comments may be shown as answers.

Binding Appointments to Scheduleview After Service Call

2 Answers 60 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 18 Nov 2014, 11:19 PM
I'm working with a scheduleview in timeline mode.  I have a "name" resourcetype and group description so appointments should show up in the row corresponding to their resource.  Everything was working fine when I created this application with hard-coded dummy data.  I created the resources (a list of people), added them to a resource type which the scheduleview binds to, then created my appointments and assigned those resources to the appointments, which in turn the scheduleview also binds to.  This all works as expected and I get a nice scheduleview in timeline mode with a list of staff and their corresponding appointments.  The problem happens when I change the application to actually retrieve my data from a WCF service.  This is done asynchronously of course, and in the data complete event I'm updating my public Appointments property with the retrieved data.  However, the scheduleview is not updating and/or displaying the appointments.  I am implementing onpropertychanged in the Appointments property, and I did debug it and make sure the appointments from the service are received and being loaded into the Appointments property.  The UI just isn't displaying the appointments.  I do see all the resources listed on the scheduleview...just no appointments.  Am I missing something?  Let me know if you need more info.
As always, thanks for your help!

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 19 Nov 2014, 09:20 AM
Hello Scott,

As far as I understand you have Appointments property in the ViewModel, the AppointmentsSource of the ScheduleView is bound to it and the data is received asynchronously. If that's the case, please try to define the Appointments property initially as an empty ObservableCollection ( in the constructor of the ViewModel) and then just add the Appointments to it.

If this does not help, I'd ask you to send us a small demo project where we could test the exact scenario. You should open a support ticket and attach it there.

Regards,
Yana
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Scott
Top achievements
Rank 1
answered on 25 Nov 2014, 05:39 PM
Thanks Yana, I figured this out.  To anyone that might view this, my problem was that I wasn't using the same resource to attach to the resource type collection that I was using to attach to the appointment.  I was creating a new resource with the same name and resource type, but that doesn't work.  You have to actually use the same instance of the resource object to attach to both appointment and res. type collection.  I simply stored the resources in a global collection and attached them to both appointment and resource type collection.  It seems strange you have to do this twice...it would be easier if you could just attach a resource to an appointment and the scheduleview would be smart enough to know where the appointment ends up, but that doesn't appear to be the case.

Thanks again!










Tags
ScheduleView
Asked by
Scott
Top achievements
Rank 1
Answers by
Yana
Telerik team
Scott
Top achievements
Rank 1
Share this question
or