Back to Devexpress

ControlRowSource Class

corelibraries-devexpress-dot-data-dot-controls-4d63df57.md

latest4.3 KB
Original Source

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.2.dll

NuGet Packages : DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design

Declaration

csharp
[ToolboxBitmap(typeof(ResFinder), "Bitmaps256.ControlRowSource.bmp")]
public class ControlRowSource :
    Component,
    ITypedList,
    ISupportInitialize,
    IDXCloneable,
    IControlRowSourceComponent,
    IListSource,
    INotifyPropertyChanged
vb
<ToolboxBitmap(GetType(ResFinder), "Bitmaps256.ControlRowSource.bmp")>
Public Class ControlRowSource
    Inherits Component
    Implements 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.
csharp
// 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");
vb
' 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"})

View Example

Note

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

Inheritance

Object MarshalByRefObject Component ControlRowSource

See Also

Display Data from WinForms Controls in a Chart

ControlRowSource Members

DevExpress.Data.Controls Namespace