BitmapImage.UriSource Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the URI of the graphics source file that generated this BitmapImage.

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


Public Property UriSource As Uri
public Uri UriSource { get; set; }
<BitmapImage UriSource="uri"/>

XAML Values

  • uri
    A URI string. See Remarks; considerations for setting the URI are identical in XAML or code.

Property Value

Type: System.Uri
The URI of the graphics source file that generated this BitmapImage.


Dependency property identifier field: UriSourceProperty

The property 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 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.