I'm trying to display a report in a WPF window and I'm stuck.
I know I had something similar working a while back but with the changes I've made and upgrade to the Telerik ReportViewer I can't seem to accomplish the task now.
Here's the code for my ReportViewer window:
Here's the calling window:
...
I know I had something similar working a while back but with the changes I've made and upgrade to the Telerik ReportViewer I can't seem to accomplish the task now.
Here's the code for my ReportViewer window:
public partial class MyReportViewer : Window |
{ |
private IReportDocument myReport; |
public MyReportViewer(IReportDocument document) |
{ |
myReport = document; |
InitializeComponent(); |
} |
private void WindowLoaded(object sender, RoutedEventArgs e) |
{ |
System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); |
ReportViewer rptViewer = new ReportViewer(); |
rptViewer.Report = this.myReport; |
rptViewer.RefreshReport(); |
host.Child = rptViewer; |
} |
} |
Here's the calling window:
...
KeyFront keyfront = new KeyFront(zone.ZoneID); |
MyReportViewer rptViewer = new MyReportViewer(keyfront); |
rptViewer.Show(); |
Here's the report code:
public KeyFront(int zonepk) |
{ |
/// <summary> |
/// Required for telerik Reporting designer support |
/// </summary> |
InitializeComponent(); |
this.sqlDataAdapter1.SelectCommand.Parameters["@ZonePK"].Value = zonepk; |
this.DataSource = this.sqlDataAdapter1; |
// |
// TODO: Add any constructor code after InitializeComponent call |
// |
} |
The report viewer window does appear but is blank. What am I missing?
Thanks,
-Sid Meyers.