BitmapImage.UriSource Property


Gets or sets the Uri source of the BitmapImage.

Namespace:   System.Windows.Media.Imaging
Assembly:  PresentationCore (in PresentationCore.dll)

Public Property UriSource As Uri

Property Value

Type: System.Uri

The Uri source of the BitmapImage. The default is null.

If StreamSource and UriSource are both set, the StreamSource value is ignored.

Identifier field


Metadata properties set to true


The following example demonstrates the use the UriSource property in Extensible Application Markup Language (XAML) and code.

' 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.UriSource = New Uri("/sampleImages/cherries_larger.jpg", UriKind.RelativeOrAbsolute)
' Set the image source.
simpleImage.Source = bi

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