Image.Source Property

Definition

Gets or sets the ImageSource for the image.

public System.Windows.Media.ImageSource Source { get; set; }

Property Value

The source of the drawn image. The default value is null.

Examples

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"/>

Remarks

XAML Attribute Usage

<object Source="imageUri"/>

XAML Text Usage

For XAML information, see the ImageSource type.

XAML Values

imageUri System.String

A URI of the image file.

Dependency Property Information

Item Value
Identifier field SourceProperty
Metadata properties set to true AffectsMeasure,

AffectsRender

Applies to