Image.Source Propiedad

Definición

Obtiene o establece ImageSource para la imagen.

public:
 property System::Windows::Media::ImageSource ^ Source { System::Windows::Media::ImageSource ^ get(); void set(System::Windows::Media::ImageSource ^ value); };
public System.Windows.Media.ImageSource Source { get; set; }
member this.Source : System.Windows.Media.ImageSource with get, set
Public Property Source As ImageSource

Valor de propiedad

ImageSource

Origen de la imagen dibujada. El valor predeterminado es null.

Ejemplos

En el ejemplo siguiente se muestra cómo usar la Source propiedad .

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 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;
Dim myImage3 As New Image
Dim bi3 As 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"/>

Comentarios

Uso de atributos XAML

<object Source="imageUri"/>  

Uso de texto XAML

Para obtener información de XAML, consulta el ImageSource tipo .

Valores XAML

imageUri
System.String

URI del archivo de imagen.

Información sobre propiedades de dependencia

Campo identificador SourceProperty
Propiedades de metadatos establecidas en true AffectsMeasure,

AffectsRender

Se aplica a