I have a single XamReportViewer that I am using to bind to multiple different reports at runtime by using binding. These different reports have different numbers and types of data sources. I have tried to swap out the data sources in my code-behind by using the ReportProcessingRequested and ProcessingStarted however if i try to modify the ClientRenderSettings.DataSources during those calls it forces the event into a loop. Is there some other event that I should be using or is there some other method I should be using to swap out the data sources on a XamReportViewer? I can always use a template selector to pick a specific instance of a XamReportViewer template but then I would be forced to define separate templates for each report.
I tried setting the XamReportViewer.RenderSettings to a new instance of ClientRenderSettings however that wound up in the same loop as if i create a new instance of DataSources for the ClientRenderSettings.DataSources property. I am doing this in the ProcessingReportRequested event so I'm not sure if there is some other event I should be doing this in or if what I am doing is just not feasible with this method.
I'll see if I can use the other link you sent however I'm not sure I'll be able to get the kind of flexibility I will need with it.
Hi Jerry,
You have two choices:
1. You can assign a new instance of ClientRenderSettings to XamReportViewer.RenderSettings property, and this new instance would have the bindings to the new data source and report location.
2. Change the report data source at runtime using a Runtime Data Source provider.
Regards,Héctor