BitmapImage.UriSource プロパティ

定義

UriBitmapImage ソースを取得または設定します。Gets or sets the Uri source of the BitmapImage.

public:
 property Uri ^ UriSource { Uri ^ get(); void set(Uri ^ value); };
public Uri UriSource { get; set; }
member this.UriSource : Uri with get, set
Public Property UriSource As Uri

プロパティ値

Uri

UriBitmapImage ソース。The Uri source of the BitmapImage. 既定値は、null です。The default is null.

次の例は、およびコードUriSourceExtensible Application Markup Language (XAML)Extensible Application Markup Language (XAML)プロパティを使用する方法を示しています。The following example demonstrates the use the UriSource property in Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML) and code.

<!-- Property Tag XAML Syntax -->
<Image Width="200"  Margin="5" Grid.Column="1" Grid.Row="1" >
   <Image.Source>
      <BitmapImage UriSource="sampleImages/bananas.jpg" />
   </Image.Source>
</Image>
<!-- Property Tag XAML Syntax -->
<Image Width="200"  Margin="5" Grid.Column="1" Grid.Row="1" >
   <Image.Source>
      <BitmapImage UriSource="sampleImages/bananas.jpg" />
   </Image.Source>
</Image>
// Create the image element.
Image simpleImage = new Image();    
simpleImage.Width = 200;
simpleImage.Margin = new Thickness(5);

// Create source.
BitmapImage bi = new BitmapImage();
// BitmapImage.UriSource must be in a BeginInit/EndInit block.
bi.BeginInit();
bi.UriSource = new Uri(@"/sampleImages/cherries_larger.jpg",UriKind.RelativeOrAbsolute);
bi.EndInit();
// Set the image source.
simpleImage.Source = bi;
' Create the image element.
Dim simpleImage As New Image()
simpleImage.Width = 200
simpleImage.Margin = New Thickness(5)

' Create source.
Dim bi As New BitmapImage()
' BitmapImage.UriSource must be in a BeginInit/EndInit block.
bi.BeginInit()
bi.UriSource = New Uri("/sampleImages/cherries_larger.jpg", UriKind.RelativeOrAbsolute)
bi.EndInit()
' Set the image source.
simpleImage.Source = bi

注釈

StreamSourceUriSource 両方StreamSourceが設定されている場合、値は無視されます。If StreamSource and UriSource are both set, the StreamSource value is ignored.

依存プロパティ情報Dependency Property Information

識別子フィールドIdentifier field UriSourceProperty
メタデータプロパティがに設定されるtrueMetadata properties set to true NoneNone

適用対象

こちらもご覧ください