BitmapImage Constructor (Uri)

Initializes a new instance of the BitmapImage class, using the supplied URI.

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


Public Sub New ( _
    uriSource As Uri _
public BitmapImage(
    Uri uriSource


  • uriSource
    Type: System.Uri
    The URI that references the source graphics file for the image.


The string provided for uriSource is interpreted as a Uniform Resource Identifier (URI). This is in contrast to an Internationalized Resource Identifier (IRI). This distinction means that characters used to identify a file name that are outside of US-ASCII will need to be encoded.

Relative references are permitted. The starting location for the relative reference is the XAP package that contains the page that created the current object tree.

Cross-domain URIs are permitted (so long as the server that serves the content permits cross domain requests), and specifying the scheme is permitted, but mixing URI schemes (such as accessing an HTTPS image from a Silverlight plug-in hosted on an HTTP-served HTML page) is not permitted.

The format-specific filename extensions such as .png are not necessarily required to be in the URI naming, but if the retrieved file is not determined to be a valid image format, a runtime exception is thrown.

Version Information


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.