The problem with what you are doing is that in order to retrieve the data that is stored inside the drag and drop, you must specify the exact type .
control.DoDragDrop(new Label(), DragDropEffects.Move);
e.Data.GetDataPresent(typeof(Control)) // = false
e.Data.GetDataPresent(typeof(Label)) // = true
What you need to do is create a wrapper and use it for your drag and drop code.
class ControlWrapper
{
public Control Control { get; private set; }
public ControlWrapper(Control control) { Control = control; }
}
control.DoDragDrop(new ControlWrapper(new Label()), DragDropEffects.Move);
e.Data.GetDataPresent(typeof(ControlWrapper))
And now your code becomes
ControlWrapper controlWrapper = e.Data.GetData(typeof(ControlWrapper)) as ControlWrapper;
UserControl userControl = controlWrapper.Control as UserControl;
, , , . e.Data.GetDataPresent(typeof(ControlWrapper)) , .