Sunday, July 5, 2009

Viewing Image in Silverlight

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.


See full detail: http://www.c-sharpcorner.com/UploadFile/mahesh/ImageControl03222009230503PM/ImageControl.aspx

No comments: