Reputation: 88
I would like to display an image in WPF in its original size, which can be achieved by setting Stretch="None". However, if the image is bigger than its enclosing element, the image gets cropped, which is undesirable.
I would like the image to be downsized if it doesn't fit, but not stretched when it is smaller than its enclosing element. Is there a way to achieve this behaviour?
Upvotes: 4
Views: 5202
Reputation: 128061
Set the Image control's StretchDirection
property:
<Image Stretch="Uniform" StretchDirection="DownOnly" ... />
Upvotes: 12