Edit this page
Available for: UI for ASP.NET AJAX | UI for ASP.NET MVC | UI for WPF | UI for WinForms | UI for Silverlight

Image

Image is a content element, which contains an image source and represents an image.

Inserting an Image

Image is a content element that can be added in the Content collection of a IContainerElement such as RadFixedPage. There are several approaches which you can use to achieve that.

Example 1 shows how to initialize an Image object and add it to a previously defined container.

[C#] Example 1: Create image

Image image = new Image();
container.Content.Add(image);

Example 2 demonstrates how to use one of the factory methods of the ContentElementCollection to create a new image and insert it into the respective container.

[C#] Example 2: Add image to container

Image image = container.Content.AddImage();
Image imageWithSource = container.Content.AddImage(imageSource);

There are other methods that allow adding an image to a document by passing image size, format and source. They could be used through the FixedContentEditor class.

Modifying an Image

You can modify an Image element using the properties the class exposes. The properties are listed below.

  • ImageSource: Specifies the image source that will be visualized in the Image object.
  • Width: The width of the image.
  • Height: The height of the image.
  • Position: The Position of the image inside the IContainerElement.

See Also