开发者

Setting ScrolViewArea scroll values?

开发者 https://www.devze.com 2023-03-13 12:46 出处:网络
I\'m trying to move a scrollbar position in a ScrollViewArea in the code-behind. This is what I\'m currently doing:

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消