0

I have created a devexpress XtraReport file in my wpf application. Loaded the data into the report using custom Sql Query in Report wizard. How can i display the report on button click in a xaml usercontrol screen?

Currently i am trying to display as below :

private void GenerateZBReport_Click(object sender, RoutedEventArgs e)
{
    XtraReport report = new XtraReport();
    DocumentPreviewWindow window = new DocumentPreviewWindow();
    window.PreviewControl.DocumentSource = report;
    report.CreateDocument(true);
    window.ShowDialog();
}
User
  • 11
  • 4

3 Answers3

0

Use the DocumentPreviewControl located in a UserControl or Window. This is especially helpful in case you want to customize the preview control. This functionality is described in the following help file: Create a Custom Document Preview. Otherwise you can use the PrintHelper class: Invoke a Default Document Preview.

e1ecringe
  • 146
  • 1
  • 4
0

in your code, you've used the XtraReport class, but this class is empty. you should create a typed report class

new XtraReport1()

or load layout by calling

var report = new XtraReport();
report.LoadLayout(filePath);

and only after this you may assign it to viewer and call the CreateDocument() mehtod

k0st1x
  • 472
  • 3
  • 11
0

I think this could help:

var tool = new ReportPrintTool(report);
tool.ShowPreview();

For more information, check this link: Report viewer in XtraReports C#.Net using Winforms Devexpress?