corelibraries-devexpress-dot-data-dot-controls-4d63df57.md
A data source for a ChartControl that retrieves row data from another UI control (for example, GridControl, VGridControl, TreeList, or ListBoxControl).
Namespace : DevExpress.Data.Controls
Assembly : DevExpress.Data.Desktop.v25.2.dll
NuGet Packages : DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design
[ToolboxBitmap(typeof(ResFinder), "Bitmaps256.ControlRowSource.bmp")]
public class ControlRowSource :
Component,
ITypedList,
ISupportInitialize,
IDXCloneable,
IControlRowSourceComponent,
IListSource,
INotifyPropertyChanged
<ToolboxBitmap(GetType(ResFinder), "Bitmaps256.ControlRowSource.bmp")>
Public Class ControlRowSource
Inherits Component
Implements ITypedList,
ISupportInitialize,
IDXCloneable,
IControlRowSourceComponent,
IListSource,
INotifyPropertyChanged
The ControlRowSource component is automatically created by the Data Source Wizard when binding a ChartControl to a UI control (for example, Data Grid, TreeList, Vertical Grid, List Box). See the following help topic for more information: Display Data from WinForms Controls in a Chart.
To bind the ChartControl in code, do the following:
ControlRowSource class.ControlRowSource object to the ChartControl.DataSource property.SeriesDataMember, ArgumentDataMember, and ValueDataMembers properties to data fields.// Bind the chart to visible rows in the grid.
chartControl.DataSource = new DevExpress.Data.Controls.ControlRowSource() {
Control = mainView,
ControlRows = DevExpress.Data.Controls.ControlRows.Visible
};
// Group series by 'State'.
chartControl.SeriesDataMember = "State";
// Set argument and value bindings.
chartControl.SeriesTemplate.ArgumentDataMember = "Category";
chartControl.SeriesTemplate.ValueDataMembers.AddRange("Revenue");
' Bind the chart to visible rows in the grid.
chartControl.DataSource = New DevExpress.Data.Controls.ControlRowSource() With {
.Control = mainView,
.ControlRows = DevExpress.Data.Controls.ControlRows.Visible
}
' Group series by 'State'.
chartControl.SeriesDataMember = "State"
' Set argument and value bindings.
chartControl.SeriesTemplate.ArgumentDataMember = "Category"
chartControl.SeriesTemplate.ValueDataMembers.AddRange(New String() {"Revenue"})
Note
The ControlRowSource component is not available in the Toolbox and cannot be added manually through the designer.
Object MarshalByRefObject Component ControlRowSource
See Also