Setting ScrolViewArea scroll values?
I'm trying to move a scrollbar position in a ScrollViewArea
in the code-behind. This is what I'm currently doing:
try
{
ScrollViewer v = GetTemplateChi开发者_开发百科ld( "ScrollArea" ) as ScrollViewer;
v.SetValue( ScrollViewer.HorizontalOffsetProperty, 0 );
}
catch(Exception e)
{
System.Windows.MessageBox.Show(e.ToString());
}
But I keep getting an exception at v.SetValue.
I think you are looking for ScrollToHorizontalOffset
method.
v.ScrollToHorizontalOffset(0);
精彩评论