当我从
ItemType
的子类实例中调用DataObject.GetData(typeof(ItemType))
方法时,该方法返回null... 我该如何从子类型获取数据?谢谢。ItemType
的子类实例中调用DataObject.GetData(typeof(ItemType))
方法时,该方法返回null... 我该如何从子类型获取数据?谢谢。Create a wrapper class which takes an ItemType
instance, and when calling DoDragDrop
, pass that wrapper instead of the actual instance. On the other side, test for DataObject.GetData(typeof(WrapperClass))
instead.
Again, where the data object is being set, set a DataObject instance yourself - eg. call
ctl.DoDragDrop(new DataObject(typeof(ItemType).FullName, itemTypeInstance),
DragDropEffects.Move|DragDropEffects.Copy)
then you can just use DataObject.GetData(typeof(ItemType))
on the other side.