C# Drag and Drop - e.Data.GetData using a base class

Posted by Dustin Brooks on Stack Overflow See other posts from Stack Overflow or by Dustin Brooks
Published on 2010-04-28T16:41:40Z Indexed on 2010/04/28 16:43 UTC
Read the original article Hit count: 382

Filed under:
|
|

C# Winforms 3.5

I have a list of user controls all derived from one base class. These controls can be added to various panels and I'm trying to implement the drag-drop functionality, the problem I'm running in to is on the DragDrop event.

The DragEventArgs: e.Data.GetData(typeof(baseClass)) doesn't work. It wants:

e.Data.GetData(typeof(derivedClass1))
e.Data.GetData(typeof(derivedClass2)) etc...

Is there a way I can get around this, or a better way to architect it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about drag-and-drop