Skip to main content

BoundImageDashboardItem.ImageDimension Property

Gets or sets the dimension that provides data for the BoundImageDashboardItem.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v25.1.Core.dll

NuGet Package: DevExpress.Dashboard.Core

Declaration

[DefaultValue(null)]
public Dimension ImageDimension { get; set; }

Property Value

Type Default Description
Dimension null

A Dimension object that provides data for the BoundImageDashboardItem.

Remarks

Note that the ImageDimension can supply images in two ways, depending on the data binding mode (BoundImageDashboardItem.DataBindingMode).

  • The ImageDimension adds images as byte arrays.
  • The ImageDimension uses parts of URIs used to locate images. For instance, the URI pattern below specifies the path to the folder containing required images.

    C:\Users\Public\Documents\DevExpress Demos 25.1\Components\Data\ProductDetailsImages{0}.jpg

    Dimension values will be inserted at the {0} placeholder position.

To learn more, see Providing Images.

You can also specify the alternative text that depends on the selected dimension. For this, use the ImageAltTextDimension property.

Example

The following code snippet uses a Bound Image dashboard item to display a specified image accessible by a predefined URI.

using System.Windows.Forms;
using DevExpress.DashboardCommon;
using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Sql;
using DevExpress.XtraEditors;

namespace Dashboard_BoundImage {
    public partial class Form1 : XtraForm {
        public Form1() {
            InitializeComponent();
            Dashboard dashboard = new Dashboard();

            XmlFileConnectionParameters xmlParams = new XmlFileConnectionParameters();
            xmlParams.FileName = @"..\..\Data\DashboardProductDetails.xml";

            DashboardSqlDataSource xmlDataSource = new DashboardSqlDataSource("Data Source 1", xmlParams);
            SelectQuery selectQuery = SelectQueryFluentBuilder
                .AddTable("Products")
                .SelectColumns("Id", "Name", "Description")
                .Build("Query 1");
            xmlDataSource.Queries.Add(selectQuery);
            xmlDataSource.Fill();
            dashboard.DataSources.Add(xmlDataSource);

            BoundImageDashboardItem boundImage = new BoundImageDashboardItem();
            boundImage.DataSource = xmlDataSource; boundImage.DataMember = "Query 1";
            boundImage.DataBindingMode = ImageDataBindingMode.Uri;
            boundImage.ImageDimension = new Dimension("Name");
            boundImage.UriPattern = @"..\..\ProductDetailsImages\{0}.jpg";
            boundImage.ImageAltTextDimension = new Dimension("Name");
            boundImage.SizeMode = ImageSizeMode.Stretch;

            ListBoxDashboardItem comboBox = new ListBoxDashboardItem();
            comboBox.ShowCaption = false;
            comboBox.DataSource = xmlDataSource; comboBox.DataMember = "Query 1";
            comboBox.FilterDimensions.Add(new Dimension("Name"));
            comboBox.ListBoxType = ListBoxDashboardItemType.Radio;
            comboBox.ShowAllValue = false;

            dashboard.Items.AddRange(comboBox, boundImage);
            dashboardViewer1.Dashboard = dashboard;
        }
    }
}
See Also