An abstract class representing a View Item that displays a static image.
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.
Specify the ImageName and Id properties for the newly added item. You can select an image from the Image Picker. Click the ellipsis button () on the right of the property value when the ImageName property is focused and browse the available images.
Then, proceed to the Views | <DetailView> | Layout node and customize the Detail View’s layout.
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.
Customize a Static Image’s Size Options
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.