1

Windows フォーム アプリケーションでは、フォームを作成し、RPT ファイルをフォームにバインドするのと同じくらい簡単でした。このオプションは WPF では使用できないようです。

ボタンがクリックされたときに新しいウィンドウに Crystal Report を表示したいと思います。WPF でこれを実現する方法。

4

2 に答える 2

0

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();
于 2011-05-16T10:47:09.633 に答える
0

使用している Visual Studio のバージョンは何ですか? VS2010 の場合、ダウンロード可能な WPF CrystalReportViewer があります。

于 2011-05-12T18:05:24.123 に答える