views:

58

answers:

1

I have a custom canvas control which sits inside a scrollviewer - I have implemented drag, drop and move for items on the canvas and overridden MeasureOverride so that when I move an item around on the canvas its size reflects the changes so if I move the item beyond the visible portion of the canvas it will resize to accomodate the moved item and scrollbars will show appropriately.

However if I then bring the item into view by using the scrollbars then start to move the item back out again the scrollbars go a bit haywire.

It's a rather poor explanation of the problem I afraid but I am not sure how else to put it but hopefully it will contain enough info for somebody to point me in the right direction.

A: 

Yes you are right, more explaination of problem is required. Although I was also in a situation where I faced a lot of issues with Canvas and scroll-viewer, look at this question for problems I faced and how I solved that -

http://stackoverflow.com/questions/3061400/scrollbars-are-not-visible-after-changing-positions-of-controls-inside-a-canvas

I had to use base.InvalidateMeasure() explicitly after each operation to refresh the canvas and make the scrollbars visible.

akjoshi