Skip to main content

ImageFor

ImageFor is an editor for displaying images.

Implementation Details

ImageFor is realized by the ImageEditExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.ImageFor<ValueType> helper method, which is used to add an ImageFor extension to a view. This first method’s parameter is an expression that identifies model property to display. The second method’s parameter provides access to the ImageFor‘s settings implemented by the ImageEditSettings class, allowing you to fully customize the extension.

The ImageFor‘s client counterpart is represented by the ASPxClientImage object.

Declaration

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

@Html.DevExpress().ImageFor(model => model.Photo, settings => { settings.ToolTip = "User photo"; }).GetHtml()

The code result is demonstrated in the image below.

MVC_BinaryImageFor_Declaration.png

See Also