Image control in WPF using VB.NET
In this article we will learn how to use Image control in WPF.
In this article we will learn how to use Image control in WPF (Window Presentation Foundation).
The image control can be used to display images.
Properties: These are the following properties of this control.
This property can have the following values:
This will do no modification on the size of the image. If the image size is more than the size of the container, then the image will be cut to fit in the container.
In this case, the image will be expanded to fill the region of the container. The aspect ratio (proportion of width and height) will not be maintained.
This is the default value. In this case, the image will be resized to fit the container, but the aspect ratio will be maintained. So, there may be blank space in the container depending on the width and height of the image and container.
In this case, the image will be resized and will fill the container, but aspect ratio will be maintained by trimming some portion of the image if required.
Width and Height properties
The width and height properties of the image can be used to override the stretch property. If width and height properties are specified, then Stretch property will be ignored.
The clip property of Image control can be used in Silverlight to make certain portion of the image visible and hide some part of it.
Drag a Image control on the form.
Title="MainWindow" Height="350" Width="525">
<Image Height="150" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Image1"Stretch="Fill"
VerticalAlignment="Top" Width="200" />
Now select image control and press F4 for property and click on the source property from the property window.
Now select an Image and click on the OK Button.