Skip to content

Instantly share code, notes, and snippets.

@rikkit
Created April 4, 2013 16:06
Show Gist options
  • Save rikkit/5311712 to your computer and use it in GitHub Desktop.
Save rikkit/5311712 to your computer and use it in GitHub Desktop.
Get the scrollviewer of a WinRT ListView
public static ScrollViewer GetScrollViewer(DependencyObject o)
{
// Return the DependencyObject if it is a ScrollViewer
if (o is ScrollViewer)
{
return o as ScrollViewer;
}
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(o); i++)
{
var child = VisualTreeHelper.GetChild(o, i);
var result = GetScrollViewer(child);
if (result == null)
{
continue;
}
else
{
return result;
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment