Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Source Property

Image.Source Property

Gets or sets the ImageSource for the image.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public ImageSource Source { get; set; }
<object Source="imageUri"/>
For XAML information, see the ImageSource type.

XAML Values

imageUri

System.String

A URI of the image file.

Property Value

Type: System.Windows.Media.ImageSource
The source of the drawn image. The default value is null.

Identifier field

SourceProperty

Metadata properties set to true

AffectsMeasure,

AffectsRender

The following example demonstrates how to use the Source property.

Image myImage3 = new Image();
BitmapImage bi3 = new BitmapImage();
bi3.BeginInit();
bi3.UriSource = new Uri("smiley_stackpanel.PNG", UriKind.Relative);
bi3.EndInit();
myImage3.Stretch = Stretch.Fill;
myImage3.Source = bi3;
<Image Source="smiley_stackpanel.png" Stretch="Fill"/>

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft