zetar
zetar

Reputation: 1233

How to calculate the amount of offset for a scrollViewer?

Does anybody know the ratio of ScrollToHorizontalOffset and ScrollToVerticalOffset to the window size? Is there a rule of thumb?

Given an X,Y I want to center the window on the X,Y, so what would the offsets be? No, this doesn't work:

 scrollViewer.ScrollToHorizontalOffset(X);
 scrollViewer.ScrollToVerticalOffset(Y);

Doing some tests it seemed like scrollViewer took about 28 steps to scroll a window that was 2,048 by 2,048.

Upvotes: 1

Views: 1553

Answers (1)

dev hedgehog
dev hedgehog

Reputation: 8791

There is no such a thing like rule of thumb.

ScrollView.Extent is the complete size.

ScrollViewer.Viewport is the visible size.

ScrollViewer.VertiacalOffset is the current Y offset value.

ScrollViewer.HorizontalOffset is the current X offset value.

Upvotes: 2

Related Questions