Back to Devexpress

Dashboard.DataSources Property

dashboard-devexpress-dot-dashboardcommon-dot-dashboard-124f4ca2.md

latest7.7 KB
Original Source

Dashboard.DataSources Property

Gets the collection of dashboard data sources.

Namespace : DevExpress.DashboardCommon

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

NuGet Package : DevExpress.Dashboard.Core

Declaration

csharp
public DataSourceCollection DataSources { get; }
vb
Public ReadOnly Property DataSources As DataSourceCollection

Property Value

TypeDescription
DataSourceCollection

A collection of objects implementing the IDashboardDataSource interface.

|

Remarks

The DataSources property provides access to the collection of the dashboard data sources. See Supported Data Sources for information about what types of data sources you can add to the DataSources collection. Use the data source’s ComponentName property to find the data source in DataSourceCollection.

All data-aware dashboard items expose the DataDashboardItem.DataSource property that allows you to specify the required data source for the dashboard item. If you are using the DashboardSqlDataSource and DashboardEFDataSource, set the DataDashboardItem.DataMember property to specify a required data member in a dashboard data source. For instance, for a DashboardSqlDataSource data source, the data member is the name of the query (the SqlQuery.Name property).

When a data source is added or removed from the DataSources collection, the Dashboard.DataSourceCollectionChanged event is fired.

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataSources property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-dashboard-designer-merge-dashboards-to-tabs/CS/DashboardMerger/DataSourceMerger.cs#L10

csharp
public static void MergeDataSources(DataSourceCollection fromDataSources, DashboardMerger dashboardMerger) {
    DataSourceCollection toDataSources = dashboardMerger.TargetDashboard.DataSources;

winforms-dashboard-designer-bind-a-dashboard-to-a-list-object/CS/Dashboard_BindingToList/Form1.cs#L26

csharp
PieDashboardItem pies = new PieDashboardItem();
pies.DataSource = dashboard.DataSources[0];
Dimension salesPersonArgument = new Dimension("SalesPerson");

winforms-dashboard-bind-to-entity-framework-data-source-at-runtime/CS/Dashboard_EntityFramework/Form1.cs#L21

csharp
pivot.DataMember = "Orders";
pivot.DataSource = dashboard.DataSources[0];
pivot.Rows.AddRange(new Dimension("ShipCountry"), new Dimension("ShipCity"));

wpf-dashboard-how-to-bind-to-object-list/CS/WpfDashboard_ObjectDataSource/MainWindow.xaml.cs#L37

csharp
PieDashboardItem pies = new PieDashboardItem();
pies.DataSource = dashboard.DataSources[0];
Dimension salesPersonArgument = new Dimension("SalesPerson");

winforms-dashboard-customize-color-scheme/CS/Dashboard_Coloring/Form1.cs#L16

csharp
Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");
IDashboardDataSource dataSource = dashboard.DataSources["dataSource1"];

winforms-dashboard-designer-merge-dashboards-to-tabs/VB/DashboardMerger/DataSourceMerger.vb#L14

vb
Public Shared Sub MergeDataSources(ByVal fromDataSources As DataSourceCollection, ByVal dashboardMerger As DashboardMerger)
    Dim toDataSources As DataSourceCollection = dashboardMerger.TargetDashboard.DataSources

winforms-dashboard-designer-bind-a-dashboard-to-a-list-object/VB/Dashboard_BindingToList/Form1.vb#L29

vb
Dim pies As New PieDashboardItem()
pies.DataSource = dashboard.DataSources(0)
Dim salesPersonArgument As New Dimension("SalesPerson")

winforms-dashboard-bind-to-entity-framework-data-source-at-runtime/VB/Dashboard_EntityFramework/Form1.vb#L22

vb
pivot.DataMember = "Orders"
pivot.DataSource = dashboard.DataSources(0)
pivot.Rows.AddRange(New Dimension("ShipCountry"), New Dimension("ShipCity"))

wpf-dashboard-how-to-bind-to-object-list/VB/WpfDashboard_ObjectDataSource/MainWindow.xaml.vb#L33

vb
Dim pies As PieDashboardItem = New PieDashboardItem()
pies.DataSource = dashboard.DataSources(0)
Dim salesPersonArgument As Dimension = New Dimension("SalesPerson")

winforms-dashboard-customize-color-scheme/VB/Dashboard_Coloring/Form1.vb#L19

vb
dashboard.LoadFromXml("..\..\Data\Dashboard.xml")
Dim dataSource As IDashboardDataSource = dashboard.DataSources("dataSource1")

See Also

Dashboard Class

Dashboard Members

DevExpress.DashboardCommon Namespace