Image::Source Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the ImageSource for the image.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public:
property ImageSource^ Source {
	ImageSource^ get();
	void set(ImageSource^ value);
}

Property Value

Type: System.Windows.Media::ImageSource^

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

<object Source="imageUri"/>

For XAML information, see the ImageSource type.

imageUri

System::String

A URI of the image file.

Identifier field

SourceProperty

Metadata properties set to true

AffectsMeasure,

AffectsRender

The following example demonstrates how to use the Source property.

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

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: