BitmapImage.UriSource Property
.NET Framework 4.5
Gets or sets the Uri source of the BitmapImage.
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
If StreamSource and UriSource are both set, the StreamSource value is ignored.
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
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.