1

I'm making an application to dynamically add user controls on a Canvas and drag them around. First I made a window with a canvas to drag them in and everything worked fine. Then i made a user control with the code from the window. I added the control to a new window and everything still was working fine.

Now I try to add my control to the main application and the performance is very slow. The controls still follow the mouse but very slow. The application does have several other user controls. Where does this huge performance hit come from and how can I avoid it? The cpu only uses 50% and when it was working good it went to 100%.

Thank you for you're help

David

EDIT: I resolved the problem. By moving the user-controls there was an error in the image url wich prevented the application to run smoothly.

By changing the url's everything went back to normal.

DavidVdd
  • 1,020
  • 3
  • 17
  • 40
  • Just guessing, but performance hit could happen because of recalculation of visual tree. You may have to prevent layout rendering during drag operation. Maybe [this](http://stackoverflow.com/questions/3968072/move-uielement-in-visual-tree-without-recalculating-layout) can give you a hint. – nik Apr 17 '12 at 09:10

2 Answers2

1

Ive used JoshSmiths DragCanvas for this kind of thing. It work great with no lag.
JoshSmiths DragCanvas @ CodeProject

Ricibob
  • 7,505
  • 5
  • 46
  • 65
1

I resolved the problem. By moving the user-controls there was an error in the image url which prevented the application to run smoothly.

By changing the url's everything went back to normal.

Make sure to check you're url's if you're having sudden performance issues.

DavidVdd
  • 1,020
  • 3
  • 17
  • 40