tags:

views:

58

answers:

1

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 programmatically 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

A: 

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 :)

Enough already
Also while debugging i saw the width of thescroller is NaN?does it have something to do?
subash
Enough already
as u said i checked "The content must be at least 250 + the width of your scrollviewer to have any effect." but still the problem persists.
subash
@subash: You will have to provide more Xaml/code for anyone to reproduce and fix the problem. Thanks.
Enough already