2016-07-14 58 views
0

我想綁定一個xtraReport-EFdatasource列表,我已經在設計器模式下使用嚮導快速完成此操作,但我無法在運行時綁定其數據源。綁定devexpress xtrareport在運行時EFdatasource

DataSource = Services.CoursesList(); 

我在報告中構造tryed這段代碼,也沒有運氣的XtraReport1_DataSourceDemanded事件。 devexpress網站顯示了一個使用bindingsource的例子,但是使用EFdatasource。你能幫我一個代碼示例嗎?

回答

0

我建議你參考這個 - How to use Entity Framework with Xtrareports

來完成你的任務,最好的辦法是將您的報告類和 實體對象放入一個單獨的類庫。在這種情況下,您將 能夠bind the Report to a custom object at design time and provide data at run time

將數據傳遞到您的報告實例,處理 XtraReport.DataSourceDemanded event,創造你的實體對象, 並將它們傳遞到XtraReport.DataSource財產。

更多的參考資料:
How to use the XtraReport with the Entity Framework