Spinifex3
Spinifex3

Reputation: 91

Scaling in scrollviewer from code

I have a big image in the scrollviewer, so now I need to scale an image to see part of that image on the full screen. I need to do that from my code. How to do that?

Upvotes: 1

Views: 1220

Answers (1)

Filip Skakun
Filip Skakun

Reputation: 31724

In Windows 8.0 you would set the ZoomFactor property on the ScrollViewer to scale its content.

In Windows 8.1 the ScrollViewer has a ChangeView() method that takes parameters for zoom factor as well as horizontal and vertical offsets and supports view change animations.

To get it to fill your screen you would compare the ActualWidth or ActualHeight properties of your ScrollViewer and its content and set the zoom factor to the result.

Upvotes: 3

Related Questions