BitmapImage.UriSource Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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)
XMLNS for XAML: Not mapped to an xmlns.

Syntax

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.

Remarks

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 installation folder of the application.

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

Capabilities

If you use this API in your app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.

ID_CAP_NETWORKING

Windows Phone 8, Windows Phone OS 7.1

For more info, see App capabilities and hardware requirements for Windows Phone 8.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

BitmapImage Class

System.Windows.Media.Imaging Namespace