I think the title prettymuch explains it; but for a standard WPF application (not Silverlight) what is the recommended way to load up a report programmatically?
Hi Collin,
I'm not sure what you mean by programatically. The way that works both in SL and WPF is doing something like:
<ig:XamReportViewer> <ig:XamReportViewer.RenderSettings> <ig:ClientRenderSettings DefinitionUri="ReportLibrary.MyReport.igr, ReportLibrary" >
<ig:ClientRenderSettings.DataSources> <ig:DataSource TargetDataSource="Orders" ItemsSource="{Binding ElementName=domainDataSource}" /> </ig:ClientRenderSettings.DataSources> </ig:ClientRenderSettings> </ig:XamReportViewer.RenderSettings> </ig:XamReportViewer>
You can achieve that from XAML or from code.
Regards,
Andres
Hi Andres,
I am new to the Reporting and WPF. With your help from above I was able to create new RenderSettings in code behind like this:
//create render settings with report uri ClientRenderSettings renderSettings = new ClientRenderSettings { DefinitionUri = "NXA.Reporting.report1.igr, NXA.Reporting" }; //set data source renderSettings.DataSources.Add(new Infragistics.Controls.Reports.DataSource { TargetDataSource = "My Employees", ItemsSource = GetEmployees() }); //put the filled render settings into our report viewer xamReportViewer1.RenderSettings = renderSettings;
I have tried back and forth to load an IGR file from a different folder at runtime, unfortunately without any success. The purpous on it is, we would like to alter the report at runtime, save it and run the viewer after this process, with the goal that it contains the altered result.
How would I need to alter this line: DefinitionUri = "NXA.Reporting.report1.igr, NXA.Reporting"so that the software does not load the report from the embedded resources - and instead loads it from either an absolute or relative path?
SincerlyEnricoNETxAutomation
Hi Enrico,
I believe you are using the Reporting CTP syntax to reference reports, please take a look at the following topic: "How to Reference Reports" to see how this is done in 2011.2 (if you do have the latest version).
You will also find how to use reports with Build Action set to "Content" which should be the alternative to achieve what you are trying to do.
Miguel.
Hi Miguel,
You were right. I got the latest version today, installed it, and after a few changes it worked just fine.
Thank you very much for your reply and the link.
Sincerly,EnricoNETxAutomation