Windows フォーム アプリケーションでは、フォームを作成し、RPT ファイルをフォームにバインドするのと同じくらい簡単でした。このオプションは WPF では使用できないようです。
ボタンがクリックされたときに新しいウィンドウに Crystal Report を表示したいと思います。WPF でこれを実現する方法。
Windows フォーム アプリケーションでは、フォームを作成し、RPT ファイルをフォームにバインドするのと同じくらい簡単でした。このオプションは WPF では使用できないようです。
ボタンがクリックされたときに新しいウィンドウに Crystal Report を表示したいと思います。WPF でこれを実現する方法。
Window クラスを使用して実行できます。
デモンストレーションについては、以下のコードを参照してください
MyWindowType myReport = new MyWindowType(); // create a window, MyWindow is an User Control of type Window, that is it extends Window
MyCrystalReport myReport = new MyCrystalReport();
// Do necessary modifications to myReport such as Add Data and Send Parameters
CrystalReportViewer rptViewer = new CrystalReportViewer(); // Construct a ReportViewer
WindowsFormsHost host = new WindowsFormsHost(); // Create a WindowsFormsHost
rptViewer.ReportSource = myReport; // Add Report to ReportSource
host.Child = rptViewer; // Add report viewer as child to host
myReport.reportGrid.Children.Add(host); // Add host to MainWindow, that is myReport in this example
myReport.BringIntoView();
myReport.Show();
使用している Visual Studio のバージョンは何ですか? VS2010 の場合、ダウンロード可能な WPF CrystalReportViewer があります。