簡體   English   中英

Visual Studio 2010 Crystal Reports WPF

[英]visual studio 2010 crystal reports wpf

我創建了報告,但似乎無法將報告查看器與報告源綁定? 我認為他們改變了工作方式?

從SAP支持網站http://forums.sdn.sap.com/message.jspa?messageID=8995372

//Using the ReportDocument SDK
this._report = new ReportDocument();
this._report.Load(@"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\CrystalReportWpfApplication1\CrystalReportWpfApplication1\CrystalReport1.rpt");
this.reportViewer.ViewerCore.ReportSource = this._report;

這可能是一個很晚的答案,但可能會幫助正在尋找類似問題的其他人。 如果要綁定ReportSource,則需要將CrystalReportViewer控件包含在UserControl的WindowsFormsHost中,並聲明string類型的依賴項屬性。 您需要從此處設置ReportSource。 您不能直接從XAML將其與本機控件綁定。

我有同樣的問題,但就像上一篇文章一樣,盡管它可能對其他人有幫助。

WPF的CrystalReportViewer具有一個名為“內容”的屬性。 這個Content屬性實際上是一個StackPanel,帶有3個子級,第三個是這個新元素“ ViewerCore”,它填充了DockPanel(LastChildFill)上的所有可用空間。

ReportSource屬性位於此ViewerCore中,因此,要訪問此ViewerCore(ReadOnly)屬性,您需要執行以下操作:

添加對SAPBusinessObjects.WPF.Viewer的引用

using SAPBusinessObjects.WPF.Viewer;添加using語句using SAPBusinessObjects.WPF.Viewer;

然后設置報告來源

ViewerCore view = crReportViewer.ViewerCore; view.ReportSource = cryRpt;

HTH Noelle

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM