Saad
Saad

Reputation: 374

Silverlight: Move the ScrollViewer by code?

I wanna to move the "ScrollViewer" control left and right by buttons outside it, I found this function:

ScrollViewer.LineLeft()

It's ok but I wanna to increase the amount of movement to left by each click by specific amount like 200 pixel?

There is another thing: how I can make my button when hold the mouse on it to duplicate executes it's click event handler until the mouseleftbutton becomes Up (like the buttons of the scroll itself)?

Thanks.

Upvotes: 0

Views: 1350

Answers (1)

robertos
robertos

Reputation: 1796

For your first question, you can derive your content control from IScrollInfo and implement the LineLeft method yourself as you want.

If you just want to jump to a position using other buttons (external to the ScrollViewer), you can use the SetHorizontalOffset and SetVerticalOffset methods.

To make the Button to fire Click repeatedly, just replace it by a RepeatButton: http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.repeatbutton(VS.95).aspx

Upvotes: 1

Related Questions