Please take a look at the attached project.
I have a custom appointment class and I don't want to have to map all the appointment properties manually but UseDefaultPropertyMappings doesn't work.
In "ViewModel.cs" lines 37 to 52 are my problem.
Hello StillLearnin,
Thnak you for the sample, I have been looking into it and I noticed that even when you explicitly set the property mapping you still get some binding errors. You can notice that there is a thin red border rendered around your appointments. Also you can check that in the output window you get the following binding error:
The following property mappings are missing for Appointment items:
In order to support recurring activities, the 'Recurrence' field is required.
In order to support variances (modifications to occurrence of a recurring activity), the following fields are required.
RootActivityId
OriginalOccurrenceStart
OriginalOccurrenceEnd
IsOccurrenceDeleted
VariantProperties
RecurrenceVersion
In order to support reminders, the following fields are required.
ReminderEnabled
ReminderInterval
Therefore I can suggest you map this properties as well. For additional reference you can check:
http://help.infragistics.com/Help/NetAdvantage/WPF/2011.2/CLR4.0/html/InfragisticsWPF4.Controls.Schedules.v11.2~Infragistics.Controls.Schedules.AppointmentProperty.html
http://help.infragistics.com/Help/NetAdvantage/WPF/2012.1/CLR4.0/html/xamSchedule_Using_Connector_Mapping.html
If you have any additional questions with this matter please feel free to contact me.
Sorry it took so long to get back on this...
Let me rephrase the question to try to make it more clear. First a Quote from the second link you gave. (Bold face is mine.)
Note: Property mapping collection has a UseDefaultMappings property. If the names of the properties of the data source object are the same as the names of the properties of the xamSchedule entity object, this property can be set to true to automatically map the properties. Reflection is used to find properties with the same names and any matching properties are automatically mapped.
My point is this. The property names in my class Do Match the names of the properties of the xamSchedule entity object. So why doesn't UseDefaultMappings work? In my example I manually mapped the minimum required fields to show that it does actually work when I manually map the fields but I don't want to do this for the production app.
I changed your sample commenting out the "ThisDoesWork" region and uncommenting the "ThisDoesn'tWork" region. The only problem I see is that your Recurrence property defaults to an empty string. So the connector thinks you are trying to provide recurrence information (since the Recurrence is non-null) but the activities are neither occurrences or recurrence roots. Since the activities are in an invalid state (they have recurrence info but aren't really recurrence related, they are not part of the available activities). Changing the _recurrence to null instead of "" works.
Excellent catch! I knew I was missing something simple...
Thank you very much!