❔ "Zooming" a WPF ScrollViewer to the center of the view
So I made this control (whose parent is the ScrollViewer i'm talking about), that has a "TargetWidth" and "ZoomScale" property (Setting either results in the Width property being set to
TargetWidth * ZoomScale
)
I've got that implemented, but I've been struggling for the past 2 hours to implement a way to make it "zoom" towards the center of the view (as in, the ScrollViewer's view port, therefore including the current vertical and horizontal offset)
Could anyone help? Every attempt I either zooms way too far to the left/right, or it initially works as intended, but then gradually starts zooming towards the left or right
here's the mess of code I've been working with so far:
2 Replies
That code I posted just zooms towards the left if the current horizontal offset is 0 and when you zoom out it starts zooming towards the right. BUt if the horizontal offset is a bit greater than 0, then it shoots off to the right
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.