#276 – Change Image Sizing Using the Stretch Property

The Stretch property of an Image control dictates whether the image will be stretched to fit the available space.

The None option indicates that the image should be displayed at its original size.  It is not stretched to fit the available space.

	<Image Source="TractorSm.png" Stretch="None"/>

The Uniform option (the default) causes the image to be stretched to fill the available space–just until one of its dimensions fits.  The container may show whitespace for the other dimension.

<Image Source="TractorSm.png" Stretch="Uniform"/>


The UniformToFill option also preserves the aspect ratio, but the image will continue to grow until both dimensions fit the available space.  The container may clip the image in one dimension.

<Image Source="TractorSm.png" Stretch="UniformToFill"/>


The Fill option stretches the image without preserving the aspect ratio, exactly filling the available space.  The image may appear distorted.

<Image Source="TractorSm.png" Stretch="Fill"/>

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

One Response to #276 – Change Image Sizing Using the Stretch Property

  1. Pingback: #281 – Give an Image Control More Room with a Margin « 2,000 Things You Should Know About WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: