I rely on the Activity.DataItem to make images visible. Everything is fine, but when I drag the appointment to another timeslot (not releasing the mouse up yet), I see the binding not working.
After some investigating, I concluse that the dragged Appointment Activity is somehow cloned from the orginal Activity, but the DataItem is NULL!!
Is this a bug?
Hi Steven,
I’ve been consulting with Andrew and it turns out that the metadata information he mentioned is not available during the copy so his suggestion is not going to work for you. And as you already know neither is the DataItem.
I’m in the process of submitting a development issue concerning this behavior. I am going to create a case for you and I will contact you directly thru the case with more details concerning the development issue.
I'm looking into a sample for this and will post back here when I have more information
Hi Andrew,
Thanks for the explanation.
By the way, that MetadataPropertyMappings and custom AppointmentPresenter that you mention, is that a sample we can follow?
Best Regards,
Steven
During a drag, you are moving a clone of the original activity because we don't want to manipulate the original (just as Outlook does not) and because the original needs to be displayed as well should you press ctrl to indicate a copy should be created. That being said I cannot think of a reason why we cannot copy over the dataitem - at least during the drag operation. Obviously when the drag operation is complete, if a copy is generated it would have a new dataitem resulting from a new item in the source being created. In that case you would either have to use the MetadataPropertyMappings because those properties would be copied over to the new activity when it is created or you would have to handle the ActivitiesDragged event where you will be given the new activities (for a copy operation - for a move you're given the original source activities) and you would need to cache the original activities (from the Dragging event) and copy over what you need.
Note, you may want to consider using the MetadataPropertyMappings and set up your custom AppointmentPresenter to bind to Metadata[yourmetadataproperty] instead of DataItem.YourPropertyName.