0
votes

In xaml, I have the following:

ScrollViewer Name="Scv" HorizontalAlignment="Left" Margin="150,194,0,0" VerticalAlignment="Top" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"

Canvas Height="100" Name="canvas1" Width="424"

Image Canvas.Left="7" Canvas.Top="10" Height="150" Name="image1" Stretch="Fill" Width="200" ManipulationStarted="image1_ManipulationStarted"

InkPresenter Name="inkPresenter1"
inkPresenter1>

Canvas
ScrollViewer

The problem :

How to stop the ScrollViwer at the position where I stop scrolling as I need to draw something on the photo at that position?

If I use a button to stop it, it always return to the Top position even I have scrolled at the bottom

when click button to stop

Scv.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
Scv.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;

To resume scrolling after stop

Scv.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
Scv.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;

1

1 Answers

0
votes

Given that sc is the name of the ScrollViewer control, you can set the current scrolling offset to the actual one and it will stop scrolling. Like this:

sc.ScrollToVerticalOffset(sc.VerticalOffset);

If you decide to scroll it horizontally, the same idea applies.