Image

  • 2 min to read

Image is an editor for displaying images.

Implementation Details

Image is realized by the ImageEditExtension class. Its instance can be accessed via the ExtensionsFactory.Image helper method, which is used to add an Image extension to a view. This method's parameter provides access to the Image's settings implemented by the ImageEditSettings class, allowing you to fully customize the extension.

The Image's client counterpart is represented by the ASPxClientImage object.

Declaration

Image can be added to a view in the following manner.

View code (ASPX):

Image:<br/><br/>

<% 
    Html.DevExpress().Image(
        settings => {
            settings.Name = "image1";

            settings.ImageUrl = "Content/Images/olive.jpg";
        }
    )
    .Render();
%> 

View code (Razor):

Image:<br/><br/>

@Html.DevExpress().Image(
    settings => {
        settings.Name = "image1";

        settings.ImageUrl = "Content/Images/olive.jpg";
    }
).GetHtml()
Note

The Partial View should contain only the extension's code.

The code result is demonstrated in the image below.

image-declaration.png

Main Features

The Image editor can be used to display any valid image supported by the requesting browser on the web page.

ASPxImage

The path to the displayed image is specified by the ImageEditSettings.ImageUrl property. You can specify the text you wish to display in place of an image when the image is not available by setting the ImageEditSettings.Properties.AlternateText (ImageEditPropertiesBase.AlternateText) property. The ImageEditSettings.Properties.EmptyImage (ImageEditPropertiesBase.EmptyImage) property allows you to define a specific image to be displayed by the image editor if the editor's value is null (or the ImageEditSettings.ImageUrl property is not defined or is set to an empty string). The alignment of the displayed image in relation to other elements on the web page is specified by the ImageEditSettings.Properties.ImageAlign (ImageEditPropertiesBase.ImageAlign) property.