I've found this code which allows dragging a control around a canvas.
What is the way to add this draggable property programmatically to a control that's created in C#?
You can set it like this, for example:
Button b = new Button();
b.SetValue(DraggableExtender.CanDragProperty, true);