A2v10 Platform documentation
UK


Image Control

Represents an image with the possibility of binding to data.

Read more about working with binary objects

Inherits: UIElementBase

Properties

Name Type Description
Base String The URL of the model from which the image will be received.
Source Bind Always binding. Binds to the field that defines the identifier of the picture.
Width Length Image width.
Height Length Image height.
ReadOnly Boolean Disable image loading.
Limit Int32 The maximum size of the loaded image (in KB).
Placeholder String Prompt. Displayed if the image is not selected.
Icon Icon Icon. Displayed with the Placeholder placeholder if the image is not selected.
Base item properties

Specific features

Most often, only one of the Width or Height properties is set. In this case, the picture will keep the aspect ratio.

Example

Image control is used to simultaneously display and load an image using a simplified approach.

Source property must refer to a property of the model, which represents an object with two fields (Id!!Id and Token!!Token). The name of this property will define the suffix for the stored procedures that will be called to get or write the actual image bytes.

Base property must refer to the complete model (the one specified in the root of the model.json file).

XAML markup sample:


File fragment /catalog/product/model.json


Data model fragment


Getting an image

To get the image, the system will call the stored procedure a2.[Product.Image.Load], passing the Image object ID as the @Id parameter. The Name Image in the name of the procedure corresponds to the name of the property. The access token will be verified on the server (it is not passed to the procedure). If it does not match the rules, then the procedure will not be called at all.

Loading an image

When the image is uploaded to the server, the system will call the stored procedure a2.[Product.Image.Update]. The procedure will return an image ID and a new access token, which will be updated in the model.