Add an image

	<Image Source ="Assets/test_image1.png" Stretch="UniformToFill" />
	<Image Source ="Assets/Background.png" Stretch="UniformToFill" HorizontalAlignment="Center" VerticalAlignment="Center" />

	<Image Canvas.Left="380" Canvas.Top="198" Width="40" Height="40" Source="Assets/Icon_Loading.png" x:Name="LoadingIcon"  />

Stretch options:

None – No scaling is done.
Fill – Image will fill the space and aspect ratio is ignored.
Uniform – Show the entire image with blank space in one axis if needed.
UniformToFill – Ensure the whole space is filled and the aspect ration is preserved, cropping if necessary.

Adding image files to the assets folder

You need to right click the Assets folder in Visual Studio and select Add existing item (you can’t just copy files into the folder in explorer)

Image From Local Folder

img.Source = new BitmapImage(new Uri("ms-appdata:///local/SomeFolder/Logo.png"));

Spreading across whole grid

	<Image Source="MyImage.png" Stretch="UniformToFill" Grid.ColumnSpan="999" Grid.RowSpan="999"/>

Changing Image Without Blanking

Preloading the image doesn’t seem to work, the workaround until this gets fixed seems to be to have 2 images, one set to collapsed.  When you want to display a new image set the collapsed visibility one to show it and create a method for its ImageOpened event which makes it visible and collapses the visibility of the other.  Dull, but does the job

UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.