VB.NET Viewing Image in Silverlight

The Image element represents an image control in Silverlight. This article demonstrates how to use an Image control in Silverlight to display images.
  • 1928

Viewing Images

The Image object is used to view images in XAML and Silverlight. The Source property of the image is used to specify the location of the image. This property can be an absolute URL or a relative URL. The following code snippet views a jpg file using the absolute path.

<Image Source="Tree.jpg" />


The following code snippet uses an absolute URL to view a file from a website.

<Image Source="http://www.c-sharpcorner.com/UploadFile/AuthorImage/mahesh.jpg" />
  

Stretching Images

The Stretch property of the Image class that is of type Stretch enumeration is used to stretch an image. It has values None, Uniform, UniformToFill, and Fill. The Stretch enumeration is defined in Table 2. The Width and the Height property of the Image class represent the width and the height of an image.

The Width and Height properties represent the width and height of the image control.

The following code snippet views an image and stretches to uniform with width and height of the image to 200 and 200 respectively.

<Image Source="Dock.jpg" Stretch="Uniform"

       Width="200" Height="200"/>  


Summary

In this article, I discussed how we can use an Image control and view images in Silverlight and VB.NET.

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.