Hi,I want to bind custom objects (database entities) to a MonthView.I took the code snippet from "xamSchedule" > "xamSchedule" > "Using code behind"to set up the ListScheduleDataConnector. I want only one calendar per resource,so I commented out the ResourceCalendarPropertyMappings.Neither the following xaml nor the original one work. I get the error Message:Application configuration error. The functionality is not supported.Error Details:The following property mappings are missing for ActivityBase items:IdOwningResourceIdStartEndMy xaml looks like this: <ig:ListScheduleDataConnector x:Name="scheduleDataConnector" ResourceItemsSource="{Binding Resources}" AppointmentItemsSource="{Binding Appointments}"> <!--ResourceCalendarItemsSource="{Binding Calendars}"--> <ig:ListScheduleDataConnector.ResourcePropertyMappings> <ig:ResourcePropertyMappingCollection> <ig:ResourcePropertyMapping ResourceProperty="Id" DataObjectProperty="LDD_ID" /> <ig:ResourcePropertyMapping ResourceProperty="Name" DataObjectProperty="ANZEIGEWERT" /> </ig:ResourcePropertyMappingCollection> </ig:ListScheduleDataConnector.ResourcePropertyMappings> <!--<ig:ListScheduleDataConnector.ResourceCalendarPropertyMappings> <ig:ResourceCalendarPropertyMappingCollection> <ig:ResourceCalendarPropertyMapping ResourceCalendarProperty="Id" DataObjectProperty="CalendarId" /> <ig:ResourceCalendarPropertyMapping ResourceCalendarProperty="Name" DataObjectProperty="CalendarName" /> <ig:ResourceCalendarPropertyMapping ResourceCalendarProperty="OwningResourceId" DataObjectProperty="DeviceId" /> </ig:ResourceCalendarPropertyMappingCollection> </ig:ListScheduleDataConnector.ResourceCalendarPropertyMappings>--> <ig:ListScheduleDataConnector.AppointmentPropertyMappings > <ig:AppointmentPropertyMappingCollection> <ig:AppointmentPropertyMapping AppointmentProperty="Id" DataObjectProperty="LDE_ID" /> <ig:AppointmentPropertyMapping AppointmentProperty="Start" DataObjectProperty="START_DATE" /> <ig:AppointmentPropertyMapping AppointmentProperty="End" DataObjectProperty="END_DATE" /> <ig:AppointmentPropertyMapping AppointmentProperty="OwningResourceId" DataObjectProperty="LDD_LDD_ID" /> <!--<ig:AppointmentPropertyMapping AppointmentProperty="OwningCalendarId" DataObjectProperty="LDD_LDD_ID" />--> <ig:AppointmentPropertyMapping AppointmentProperty="Subject" DataObjectProperty="KOMMENTAR" /> <ig:AppointmentPropertyMapping AppointmentProperty="Description" DataObjectProperty="KOMMENTAR" /> </ig:AppointmentPropertyMappingCollection> </ig:ListScheduleDataConnector.AppointmentPropertyMappings> </ig:ListScheduleDataConnector>I suppose the error message refers to the Appointment mapping. But I do not understand the error message because the xaml specifies the properties mentioned in the error message.What am I missing here?One more question: My objects' Ids are decimal and my DateTimes are nullable - do I need to use converters?Cheers, crs
Hello,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Hi,
I created a basic example and attached it. The error I described in the previous post is gone.
However it does not work as expected - I don't see anything: The calendar only displays a scrollbar that shows a tooltip for a date.
I would also like to have just 1 calendar for all resources (i.e. get rid of the MyCalendar class). Is that possible?
Regards
CRS
I have been looking into your sample and I can say that you have to add CalendarGroups to the XamScheduleDataManager. You can do it like this:
<ig:XamScheduleDataManager.CalendarGroups> <ig:CalendarGroup InitialCalendarIds="2[Cal2],1[Cal1]" /> <!--<ig:CalendarGroup InitialCalendarIds="2[Cal2] <ig:CalendarGroup InitialCalendarIds="1[Cal1]"/>--> </ig:XamScheduleDataManager.CalendarGroups>
This way the calendars will be grouped. If you want them to be side by side you can comment this CalendraGroup and Uncomment the other two. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
I added your Xaml. I now have two calendars but with no appointments visible.
But what I need is all appointments for all resources visible at once (no tabs for several calendars).
What do I need to accomplish this?
Best Regards, CRS
There are a few issues with your sample. First, the END_DATE of your data items is before their START_DATE so that will cause some an error once it is setup properly. Second, you are defining ResourceCalendars and a mapping for the OwningCalendarId but that mapping is using the same field it is using for the OwningResourceId (i.e. it will have a value like "1" or "2") and that doesn't match the id of the resource calendar associated with that resource (your calendar has an id of "Cal1" or "Cal2"). So either you need to change the Id of the calendars to match the id of the resource (since you'll only have 1 calendar per resource) or if you don't want to provide resource calendars then you can remove all the calendar related information and the datamanager will internally create a default one and use that. For the latter you would remove the "ResourceCalendarItemsSource", remove the ResourceCalendarPropertyMappings, remove the property mapping for the OwningCalendarId and change the InitialCalendarIds to be just the resource ids - e.g. "2,1".
Note if you don't want the tab headers then you can set the CalendarDisplayMode to "Merged" instead of "Overlay". It is not possible to use a single ResourceCalendar across multiple Resources as the ResourceCalendar is owned by the Resource but this will display them in a single group without the headers.
I've attached an updated version of your sample that does the latter - i.e. removing the calendars since based on the comments in your sample you don't seem to want to define them.
Thanks a lot. That definitely helps me.
But I have one more issue: The initial calendar ids are hard coded as a string. I tried to use binding instead, But binding to a string with the same content does not work. Is there a way to use binding to set the initial calendar ids?
I am just checking if you need any further assistance on the matter.
Yes, this can easily be done with a behavior or attached property. I have modified the sample to be more MVVM friendly, and to use an attached property to data bind to the InitialCalendarIds. Of course, you need to customize this to meet your needs.
<ig:XamScheduleDataManager x:Name="dataManager" DataConnector="{Binding ElementName=scheduleDataConnector}"
common:CalendarGroup.InitialCalendarIds="{Binding InitialCalendarIds}">
<ig:XamScheduleDataManager.Settings>
<ig:ScheduleSettings WorkDays="Monday, Wednesday, Friday, Saturday"/>
</ig:XamScheduleDataManager.Settings>
</ig:XamScheduleDataManager>
I am following up on this issue as we need to produce dynamically defined Calendar Groups based on a user's view configuration. Has this issue been addressed in subsequent releases? Can you possibly provide a workaround that does not involve hard coding the initialcalendarids in the xaml or code behind?
Thanks,
David