ControlRowSource Class
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.1.dll
NuGet Packages: DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design
Declaration
[ToolboxBitmap(typeof(ResFinder), "Bitmaps256.ControlRowSource.bmp")]
public class ControlRowSource :
Component,
ITypedList,
ISupportInitialize,
IDXCloneable,
IControlRowSourceComponent,
IListSource,
INotifyPropertyChanged
Remarks
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:
- Create a new instance of the
ControlRowSource
class. - Initialize Control and ControlRows properties.
- Assign the
ControlRowSource
object to the ChartControl.DataSource property. - Map the Chart Control’s
SeriesDataMember
,ArgumentDataMember
, andValueDataMembers
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");
Note
The ControlRowSource
component is not available in the Toolbox and cannot be added manually through the designer.