How do I keep aspect ratio on scalable, scrollable content in WPF?

You need to put the content (the grid) inside a Viewbox and set the Viewbox.Stretch Property to Stretch.Uniform

The Viewbox control is used to stretch or scale a child element and lets you control the way the child is stretched. Check the examples here.

alt text
(source: microsoft.com)

Leave a Comment