wpfflowdocumentflowdocumentscrollviewer

How can I get the position from FlowDocumentScrollViewer?


I'm trying to get the position from FlowDocumentScrollViewer. And save it to db.

After that, close and re-open the program. At that time, the scroll should be set to what I saved position.

Simply, I hope to save that I watched position. and later, when I open it, I want to see the position which I watched last time.

Now, I'm watching this class, but I couldn't find some method or variables about this feature. FlowDocumentPageViewer has GoToPage(), so I hope to get this kind of method from FlowDocumentScrollViewer.

How can I create thesas feature?


Solution

  • as described here you need to get the scollviewer property of your FlowDocumentScrollViewer. than you can get scrollbar position with myScrollViewer.VerticalOffset and set it with myScrollViewer.ScrollToVerticalOffset(double value)