If you want the ScrollViewer to accommodate the scaled content, just set the content's LayoutTransform instead of its RenderTransform. The key difference is that the effects of a LayoutTransform are taken into consideration during measure and arrange, and it sounds like that's exactly what you want.
Set the scrollable area size of WPF's scrollviewer
-
03-07-2022 - |
Question
I use ScrollViewer
to be able to scroll the content inside the scrollviewer. Now I also need to be able to zoom the contents, and I use RenderTransform
to scale up the contents, but the ScrollViewer
doesn't recognize the scaled content (the scrollable area doesn't grow).
How can I manually calculate and the set the ScrollViewer
's scrollable area? Let's sat i'd like the scrollable area to be like 1000 x 1000 pixels, even when the content is only 100 x 100 pixels wide.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow