Skip to main content
.NET 6.0+

StaticImage Class

An abstract class representing a View Item that displays a static image.

Namespace: DevExpress.ExpressApp.Editors

Assembly: DevExpress.ExpressApp.v23.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public abstract class StaticImage :
    ViewItem

Remarks

The StaticImage class is an abstract class from which all the Static Image View Items derive (for WinForms and Web applications). The class itself derives from the ViewItem class responsible for implementing basic functionality for items in a Detail View.

Add a Default Static Image

To add a Static Image View Item to a Detail View, use the Model Editor.

  • Navigate to Views | <DetailView> | Items.
  • Right-click the node and select Add… | StaticImage.

    StaticImage

  • Specify the ImageName and Id properties for the newly added item. You can select an image from the Image Picker. Click the ellipsis button (EllipsisButton) on the right of the property value when the ImageName property is focused and browse the available images.

    StaticImageProperties

  • Then, proceed to the Views | <DetailView> | Layout node and customize the Detail View’s layout.

    StaticImageLayout

Add a Custom Static Image

You may need to implement a custom Static Image View Item with a specific image-displaying control.

  • Add a public class that inherits from StaticImage to a UI-specific module project. If your solution does not contain this project, add this class to an application project.
  • Override the protected virtual CreateControlCore method and return an instance of the required control.
  • Apply the ViewItemAttribute to the custom item. This will add a child node to the ViewItems node in the Application Model.

For more information, refer to the View Items and How to: Implement a View Item topics.

Customize a Static Image’s Size Options

If a StaticImage is displayed incorrectly in your application, choose the appropriate ImageSizeMode in the Model Editor. SizeMode

For SVG images, you can also specify SvgImageHeight and SvgImageWidth. In WinForms applications, these properties work only with the following ImageSizeMode values: AutoSize, CenterImage, or Normal. In ASP.NET Web Forms applications, the SvgImageHeight and SvgImageWidth properties do not depend on the ImageSizeMode property.

See Also