I'm trying to make smart scrolling for a canvas that expands in size. I want the scrollbars to automatically go to the center of their range. So I use:
scrollviewer.ScrollToVerticalOffset(space.Height/2);
scrollviewer.ScrollToHorizontalOffset(space.Width/2);
Which works but when the scrollbars scroll they go beyond the half point, it seems it's top aligned. So I wanted to subtract the scrollbar Height or Width so the scrollbars would be perfectly centered at the canvas.
I read in other posts that I can do this is at
SystemParameters.ScrollHeight
or
SystemParameters.ScrollWidth
But how does that work? I have multiple scrollviewers in the window. I want the height or width of the scrollbars of this specific scrollviewer.
Any other way I'm not aware off?
Thanks
Aucun commentaire:
Enregistrer un commentaire