Reputation: 1537
I have my Canvas inside a scroolviewer with a large background image (width and height is double of my screen). I put some shapes inside the canvas and I can select them from a listbox. When I select a shape from my listbox, the shape is highlighted.
The problem is that when I select a shape wich is out of the screen, I can't see where it is, so I want to move the canvas camera in order to see it. I can explain it better with an image:
Here if I select "shape 1" or "shape 2", I can see them highlighted 'cause them are into the screen, but if I select shape 3, it will be highlighted but I can't see where it is...I have to move my canvas in order to make shape 3 visible...
Thank you all!
Upvotes: 4
Views: 231
Reputation: 27115
If you can obtain a reference to Shape 3 you can use the ScrollViewer
's BringIntoView method to scroll to the correct position:
UIElement shape3;
shape3.BringIntoView();
Upvotes: 4