XRPictureBox.ImageUrl Property
Bindable. Gets or sets the path to the image to display in the XRPictureBox control.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v18.2.dll
Declaration
[SRCategory(ReportStringId.CatData)]
[DefaultValue("")]
public string ImageUrl { get; set; }
Property Value
Type | Default | Description |
---|---|---|
String | String.Empty | A String which represents the path to an image. |
Remarks
Use the ImageUrl property to specify the URL of the image to display in the XRPictureBox control. You can assign images of the following formats: BMP, JPG, JPEG, GIF, TIF, TIFF, PNG, ICO, DIB, RLE, JPE, JFIF, EMF, WMF, SVG.
To save images along with a report definition, use the XRPictureBox.ImageSource property instead.
After setting the ImageUrl property’s value, the XRPictureBox.ImageSource property is set to null (Nothing in Visual Basic). Setting the XRPictureBox.ImageSource property changes the ImageUrl property value to Empty.
Note
The ImageUrl property is bindable, which means that you can bind it to a data field from a report’s data source. See Binding Report Controls to Data to learn more.
Specifying the Path to an Image
You can assign both absolute and relative image paths to the ImageUrl property.
- A relative path is specified relative to a current working directory and should start with the “~” symbol. Moving the application to another directory means the code has to be updated.
- An absolute path provides the complete path and makes it easier to move the entire application to another directory on the server without having to update the code.
Resolving Image URL’s in Web Applications
In web applications, the ImageUrl property does not accept the “file://“ protocol by default to prevent unauthorized access to images on the server (e.g., BMP, PNG and JPG files). For security reasons, this property only supports the “http://“, “https://“ and “ftp://“ protocols by default.
To enable using the “file://“ protocol, use the corresponding methods (UrlAccessSecurityLevelSetting.RegisterCustomBaseDirectories and UrlAccessSecurityLevelSetting.RegisterCustomCallback) or set the UrlAccessSecurityLevelSetting.SecurityLevel property to one of the following UrlAccessSecurityLevel enumeration values.
- UrlAccessSecurityLevel.FilesFromBaseDirectory - enables loading images from the working directory (defined by the AppDomain.CurrentDomain.BaseDirectory property).
- UrlAccessSecurityLevel.Unrestricted - enables loading of any image from any directory.