I'm attempting to allow my users to drag and drop certain rows of data from one custom list control to another, where the second list control is in another instance of the same application.
DoDragDrop(parameterTypedListView.SelectedObjects, DragDropEffects.Copy);
where parameterTypedListView.SelectedObjects
is a generic IList where T is a custom class containing only valuetypes as fields/properties.
In the OnDragDrop event I try to extract this data but only get a System.__ComObject
... object which seems to inherit from System.MarshalByRefObject
.
In short: How do I extract the data in an object oriented format I can actually use?
Edit: Setting my custom class as serializable has no discernible effect whatsoever. I can enumerate the __ComObject:
foreach (var dataObject in (IEnumerable) e.Data.GetData("System.Collections.ArrayList"))
{
// this actually enumerates the correct number of times, i.e. as many times as there are items in the list.
}
but every dataObject is, in itself, a System.__ComObject that I cannot cast to anything useful.