视觉工作室2010水晶报道wpf

时间:2010-04-24 09:34:21

标签: c# wpf visual-studio-2010 crystal-reports

我创建了自己的报告,但似乎无法将报表查看器与报表源绑定?我认为他们改变了事情的方式?

3 个答案:

答案 0 :(得分:3)

从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;

答案 1 :(得分:1)

这可能是一个非常晚的答案,但可能会帮助其他寻找类似问题的人。 如果要绑定ReportSource,则需要将CrystalReportViewer控件包含在UserControl中的WindowsFormsHost中,并声明类型为string的依赖项属性。您需要从此处设置ReportSource。您无法直接将XAML与本机控件绑定。

答案 2 :(得分:1)

我遇到了同样的问题,但就像上一篇文章一样,虽然它可能对其他人有帮助。

用于WPF的CrystalReportViewer具有一个名为“Content”的属性。这个Content属性实际上是一个StackPanel,有3个子节点,第三个是这个新元素“ViewerCore”,它填充了DockPanel上可用的所有空间(LastChildFill)。

ReportSource属性位于此ViewerCore中,因此要访问此ViewerCore(ReadOnly)属性,您需要执行以下操作:

添加对SAPBusinessObjects.WPF.Viewer的引用

添加使用声明using SAPBusinessObjects.WPF.Viewer;

然后设置报告的来源使用

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

HTH 诺勒

相关问题