共用方式為


Image.Source 屬性

定義

取得或設定 ImageSource 影像。

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

屬性值

畫出的圖片來源。 預設值為 null

範例

以下範例示範如何使用該 Source 性質。

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

備註

XAML 屬性使用方式

<object Source="imageUri"/>

XAML 文字使用

關於 XAML 的資訊,請參見類型。ImageSource

XAML 值

影像UriSystem.String

影像檔的 URI。

相依財產資訊

項目 價值
識別碼欄位 SourceProperty
元資料屬性設為 true AffectsMeasure

AffectsRender

適用於