开发者

scrolling the silverlight ScrollViewer programmatically

i have a silverlight scrollviewer in my xaml page as below

 <ScrollViewer x:Name="scroller" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Hidden" Height="140" BorderBrush="{x:Null}">

contents here

</ScrollViewer >

and i am trying to move the scroll bar pro开发者_JAVA百科grammatically as below but it didnt worked out

  scroller.ScrollToHorizontalOffset(250);
scroller.lineleft();
scroller.moveleft();
                this.UpdateLayout();
                Upperscroller.UpdateLayout();

can any body guide me how to move the scrollbar programmatically


As a test, this code hooked up to button moves the scrollbar with nothing else required:

scroller.ScrollToHorizontalOffset(scroller.HorizontalOffset + 10);

The content was very wide though. AnthonyWJones is correct in his comment. The content must be at least 250 + the width of your scrollviewer to have any effect. HorizontalOffset is the offset of the left side of the scrollview content.

Try smaller values when testing :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜