Click here to Skip to main content
15,904,652 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m working on wpf project.I have two controls stack panel n canvas in a grid I want to drag button of stack panel to canvas plz help me out asap


I am assuming that you want to remove the child from stackpanel en add it as a new child to the canvas.

Have a look at this article to start
Dragging Elements in a Canvas[^]

This is not solving all your problems but it will put you on the right track i think.

Hope this helps.
Share this answer
Member 10835976 22-May-14 3:47am    
Thank you so much for ur reply bu i need to make a toolbox from which i can add items in canvas n can edit their height n width plz help me out if u have any idea... thanks
Vincent Beek 22-May-14 4:12am    
Even with this information I think that all the basic concepts that you need to implement are in the article. You just need to reimplement it on a stackpanel en canvas and an alternative implementation of your specific events. Unfortunatly it requires too much coding to give you a working example here, I would have to implement it myself.

If you need Toolbox functionality, you can try sukram's WPF Diagram Designer - Part 2[^]

If you merely need to drag from one control to another, and you are using MVVM, you may consider my WPF UIEventHub – MultiSelect and DragnDrop[^] and do some modification to suit your needs. (touch supported).

Joseph Leung
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900