private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
viewer.ProcessingMode = ProcessingMode.Local;
Assembly assembly = typeof(MainWindow).GetTypeInfo().Assembly;
Stream reportStream = assembly.GetManifestResourceStream("ReportViewer.Reports.MainReport.rdlc");
Stream subReportStream = assembly.GetManifestResourceStream("ReportViewer.Reports.SubReport.rdlc");
viewer.SubreportProcessing += Viewer_SubreportProcessing;
viewer.LoadSubreport("SubReport", subReportStream);
viewer.LoadReport(reportStream);
viewer.DataSources.Clear();
viewer.DataSources.Add(new Syncfusion.Windows.Reports.ReportDataSource("TopSalesPerson", SalesPersons.GetTopSalesPerson()));
viewer.RefreshReport();
}
private void Viewer_SubreportProcessing(object sender, Syncfusion.Windows.Reports.SubreportProcessingEventArgs e)
{
e.DataSources.Clear();
e.DataSources.Add(new Syncfusion.Windows.Reports.ReportDataSource("StoreSales", StoreSales.GetData()));
} |