Skip to main content

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:

  1. Create a new instance of the ControlRowSource class.
  2. Initialize Control and ControlRows properties.
  3. Assign the ControlRowSource object to the ChartControl.DataSource property.
  4. Map the Chart Control’s 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");

View Example

Note

The ControlRowSource component is not available in the Toolbox and cannot be added manually through the designer.

Inheritance

See Also