DataDashboardItem.DataSource Property

Gets or sets a data source to which the dashboard item is bound.

Namespace: DevExpress.DashboardCommon

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


public IDashboardDataSource DataSource { get; set; }

Property Value

Type Default Description


An object implementing the IDashboardDataSource interface that specifies a data source to which the dashboard item is bound.


All data-aware dashboard items expose the DataSource property that specifies a data source to which this item is actually bound. The DataDashboardItem.DataMember property specifies the required data member in this data source.

To access the collection of existing dashboard data sources, use the Dashboard.DataSources property.


For DashboardSqlDataSource or DashboardEFDataSource, specify the required data member using the DataDashboardItem.DataMember property.


The following example demonstrates how to bind a Choropleth Map dashboard item to data in code.

View Example

Imports System.Windows.Forms
Imports DevExpress.DashboardCommon
Imports DevExpress.DataAccess.ConnectionParameters
Imports DevExpress.DataAccess.Sql

Namespace Dashboard_CreateChoroplethMap
    Partial Public Class Form1
        Inherits Form

        Public Sub New()

            ' Creates a new dashboard and a data source for this dashboard.
            Dim dashboard As New Dashboard()

            Dim dataSource As New DashboardSqlDataSource()
            Dim sqlQuery As New CustomSqlQuery("Countries", "select * from Countries")
            dataSource.ConnectionParameters = New Access97ConnectionParameters("..\..\Data\countriesDB.mdb", "", "")

            ' Creates a choropleth map dashboard item and specifies its data source.
            Dim choroplethMap As New ChoroplethMapDashboardItem()
            choroplethMap.DataSource = dataSource
            choroplethMap.DataMember = "Countries"

            ' Loads the map of the world.
            choroplethMap.Area = ShapefileArea.WorldCountries

            ' Specifies a binding between the required map attribute and the data source field.
            choroplethMap.AttributeName = "NAME"
            choroplethMap.AttributeDimension = New Dimension("Country")

            ' Creates a ValueMap object with a measure that provides data for color map shapes.
            ' Then, adds this object to the Maps collection of the choropleth map dashboard item.
            Dim populationMap As New ValueMap(New Measure("Population"))

            ' Adds the choropleth map dashboard item to the dashboard and opens this
            ' dashboard in the Dashboard Viewer.
            dashboardViewer1.Dashboard = dashboard
        End Sub
    End Class
End Namespace
See Also