Gets or sets the Uri source of the BitmapImage. This is a dependency property.
Namespace:
System.Windows.Media.Imaging
Assembly:
PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

Syntax
Visual Basic (Declaration)
Public Property UriSource As Uri
Dim instance As BitmapImage
Dim value As Uri
value = instance.UriSource
instance.UriSource = value
public Uri UriSource { get; set; }
public:
property Uri^ UriSource {
Uri^ get ();
void set (Uri^ value);
}
public function get UriSource () : Uri
public function set UriSource (value : Uri)
<object UriSource="Uri" .../>
Property Value
Type:
System..::.UriThe Uri source of the BitmapImage. The default is nullNothingnullptra null reference (Nothing in Visual Basic).

Dependency Property Information

Remarks

Examples
The following example demonstrates the use the UriSource property in 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.
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
// 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;

Platforms
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information
.NET Framework
Supported in: 3.5, 3.0

See Also