How to use Data Grid as data source, and show it to DevExpress ChartControl in WPF? Or, you have alternative solution, to show chart from data grid in WPF?
3 Answers
Although it is possible to bind the DevExpress ChartControl and GridControl to the same view model collection, you can also use the standard WPF binding syntax to link the GridControl to the ChartControl.DataSource property (DataSource="{Binding ElementName=grid, Path=SelectedItems}").
This approach is shown in the "Data Grid Charting" ChartControl demo module from the DevExpress Demo Center. In this case, the chart's layout is automatically updated based on the actual grid selection state.

- 128
- 5
DataGrid should not be a data source for your ChartControl. I assume that you using MVVM pattern for WPF application.
If you don't know about MVVM please read: MVVM: Tutorial from start to finish?
In short your DataGrid from "View" is bind to a data source from "ViewModel" and ChartControl should follow the same principle, it should be bind to a data source from "ViewModel" not DataGrid itself.
Its the same as asking how do I print document from my monitor (you could do this by scanning your monitor and printing :) ). You don't connect you printer to you monitor in order to print, you use same document as "data source" from your hard drive to display it on monitor as well as print it on printer.

- 1,122
- 1
- 10
- 30
Starting from DevExpress version 15.2, Report Generator tool allows you to generate a report from the DevExpress Grid View.
See the Advanced Grid Printing and Exporting help topic for more details. However, this approach will not work for the standard DataGridView. In this case, you can either use the Report Wizard to bind a report to your DataGridView's data source and generate required layout. Alternatively, you can create the report layout manually. Review the approach described in the How to create a report dynamically article.
For specific to WPF, refer below documentation links:
Grid-Based Report Generation
Please try these solutions and let me know if any of them helps.

- 18,017
- 2
- 42
- 75