WinRT ScrollViewer scale


  • I have an app that displays data in an GridView. The GridView is virtualised to the extent that the data items in the model are not all created when the grid is displayed.  For this reason I cannot use the normal ScrollIntoView method because the element I want to scroll to may not be created yet.  Instead of this I have my own ScrollIntoView method that adjusts the scroll position of the GridView's ScrollViewer to the appropriate position where the element will be displayed.

    My problem is understanding the scale used in the ScrollViewer's horizontal position.  The ScrollViewer's size on the page is 1371x631 pixels and it's only enabled to scroll horizontally.  When I look at the ViewPort size it's the height is 631 which is a 1:1 ratio on the pixel height but the width's ViewPort size is 11.608 which makes 1 scroll unit equal to approximately 118 pixels.  This bears no relation to the size of the DateTemplate (128x128).

    Can anyone explain to me how the scale of the horizontal scrollbar is calculated?

    Wednesday, January 21, 2015 10:39 PM

All replies