Horizontal offset for scrollviewer in gridview c #

I am developing a metro application with a preview of Windows 8 and C # (VS 2012). Is there a way to scroll the horizontal scrollbar of the grid by providing HorizantalOffset. Summary: In the scroll-viewer class, you can dynamically move the horizontal scrollbar and vertical scrollbar using ScrollToHorizontalOffset and ScrollToVerticalOffset , but I do not find these properties in gridview. So how can I scroll dynamically through the code? or can i get a scrollbar link in gridview? Can anyone help me on this, thanks in advance

+4
source share
1 answer

You can get the link to the ScrollViewer from the GridView template using VisualTreeHelper. You can also use some helper methods that I put in the WinRT XAML Toolkit - in VisualTreeHelperExtensions . You just need to add

 using WinRTXamlToolkit.Extensions; 

then call

 var scrollViewer = myGridView.GetFirstDescendantOfType<ScrollViewer>() 

and there you go.

EDIT * - note that the namespace was changed in later versions of the toolkit for WinRTXamlToolkit.Controls.Extensions.

+13
source

All Articles