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