So I'm trying to get the ScheduleView to allow a gridview and a listbox drop appointments (ScheduleItems) on it - and I can't seem to get the ConvertDraggedData to work properly because the ListBox sends through an IEnumerable<IOccurrence> and my GridView sends the raw item through (ScheduleItem).
So I rolled my own GridViewDragDropBehaviour class (as there isn't one built in for the GridView) and on the OnDragInitialize event, I'm using IDragPayload.SetData() to set the data to be the raw (ScheduleItem) item. The ListBox is using the built in ListBoxDragDropBehaviour class.
This is my ConvertDraggedData code:
public override IEnumerable<IOccurrence> ConvertDraggedData(object data)
if (DataObjectHelper.GetDataPresent(data, typeof(ScheduleItem), false))
return ((IEnumerable)DataObjectHelper.GetData(data, typeof(ScheduleItem), false)).OfType<IOccurrence>();
Obviously when items are dragged from the GridView the specified cast to IEnumerable doesn't work - but it works fine from the ListBox. How do I tweak the code so that it will work for both controls?