The expected message finally appeared. Add to favorites for backup.
1) first look at the devexpress lightswitch reporting Control
Http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/32/First-Look-At-The-DevExpress-LightSwitch-Reporting-Control.aspx
2) How to: Use xtrareports in lightswitch applications
Http://documentation.devexpress.com/#XtraReports/CustomDocument9901
Xtrareports> examples> How to: Use xtrareports in lightswitch applications
This tutorial will guide you through the process of creating a simple lightswitch application containing a report using Microsoft Visual Studio 2010 or Visual Studio lightswitch. you will learn how to add a report to a lightswitch application and bind it to a data source.
To create a data-aware report in a lightswitch application, do the following.
- Create a lightswitch application with an xtrareports Extension
- Add a data source to the application
- Add a Report to the application
- Bind the report to data and adjust its layout
- Add a screen and show the report
- View the result
Create a lightswitch application with an xtrareports Extension
Run Microsoft Visual Studio 2010 or Visual Studio lightswitch.
Start a new project (CTRL + Shift + n) and create a newLightswitch Application.
Switch to the Solution Explorer (CTRL + ALT + l), right-clickApplication1, And in the invoked menu, clickProperties.
Then, in the Application Designer, switchExtensions, And enable the check box nearDevexpress. xtrareports. lightswitchExtensions, to add it to the application.
ClickSaveTo apply the changes, and close the Application Designer.
Back in the Solution Explorer, right-clickData sourcesFolder and in the invoked menu, clickAdd data source...
On the first page of the invoked wizard, chooseWCF Ria ServiceAnd clickNext.
On the next page,XtrareportsserviceIs selected by default, so clickNext.
On the last page, choose to include all entities and clickFinish.
Note |
We do not recommend you change the data source name from its default value (Xtrareportsservicedata), As well as names of other auto-generated entities and their attributes. Otherwise, the application will not work. |
Add a data source to the application
Although the following steps demonstrate how to use an external data source in your lightswitch application, xtrareports fully supports working with intrinsic data sources as well.
In the Solution Explorer, right-clickData sourcesFolder and in the invoked menu, clickAdd data source...
At this time, chooseDatabaseIn the wizard, and clickNext.
In the invokedChoose Data SourceDialog, chooseMicrosoft SQL ServerAnd clickContinue.
Next, inConnection PropertiesDialog, specify the server name, Authentication Mode and your database name.
Test the connection and clickOKTo proceed.
On the last Wizard Page, select the required table (s), and clickFinish.
Add a Report to the application
In the solution Editor, switch toFile View.
Then, right-clickServer, And in the invoked menu, chooseAdd|New item...
InAdd new itemDialog, selectXtrareport class v11.1Item, and clickAdd.
Bind the report to data and adjust its layout
After the report is added, re-build your application.
Then, click the report's smart tag and in its actions list, invoke the drop-down list for the xtrareportbase. datasource property and choose the existing data source.
Following this step, the field list reflects the structure of your report's data source, and can be used to create data-aware controls.
To group A report's data, use the group and sort panel. To show this panel, right-click your report and in the invoked menu, chooseTool WindowsAnd clickGroup and sort.
Then, group the Report byCountryField...
... And drop the corresponding item from the field list onto the created group header band.
To provide a document map to your report, bind the xrcontrol. Bookmark property of the created xrlabel to the same data field.
Add a screen and show the report
In the Solution Explorer, selectScreens, And in the invoked menu, chooseAdd screen...
InAdd new screenDialog, selectList and detail Screen, And setScreen dataTo the selected table.
In the Application Designer, right-clickScreen command bar, And chooseAdd button...
InAdd buttonDialog, specify the name for the corresponding method, and clickOK.
HandleExecute ()Method of the button, and callReportpreview. Show ()Method with the specified report name (including its namespace ).
|
partial void ShowTheReport_Execute() { ReportPreview.Show("LightSwitchApplication.XtraReport1");} Private Sub ShowTheReport_Execute() ReportPreview.Show("XtraReport1")End Sub |
C # |
partial void ShowTheReport_Execute() { ReportPreview.Show("LightSwitchApplication.XtraReport1");} |
VB |
Private Sub ShowTheReport_Execute() ReportPreview.Show("XtraReport1")End Sub |
View the result
Run the application and clickShow the report.
The result is shown in the following image.
See also
Current limitations of lightswitch reporting