Version

GeneratePreview Method

Generates a preview of a specified report and displays in via the contained DocumentViewer
Syntax
'Declaration
 
Public Sub GeneratePreview( _
   ByVal report As Report, _
   ByVal showPrintDialog As Boolean, _
   ByVal showReportProgressControl As Boolean _
) 
public void GeneratePreview( 
   Report report,
   bool showPrintDialog,
   bool showReportProgressControl
)

Parameters

report
The report to generate the preview for.
showPrintDialog
If true will display a standard PrintDialog before the report is generated.
showReportProgressControl
If true will show a progress window while the report is being generated.
Example
The following example shows how to use XamReportPreview control.

Use its properties and methods
Private  Sub XamReportPreviewSample()
 
	'initialize controls
	Dim stackPanel As StackPanel =  New StackPanel() 
	stackPanel.Children.Add(XamDataGrid1)
	Dim docViewer As XamReportPreview =  New XamReportPreview() 
	stackPanel.Children.Add(docViewer)
	Dim progressInfo As ReportProgressControl =  New ReportProgressControl() 
	stackPanel.Children.Add(progressInfo)
 
	Window1.Content = stackPanel
 
    ' 1. Create Report object
    Dim reportObj As Report =  New Report() 
 
    ' 2. Create EmbeddedVisualReportSection section. 
    ' Put the grid you want to print as a parameter of section's constructor
    Dim section As EmbeddedVisualReportSection =  New EmbeddedVisualReportSection(XamDataGrid1) 
 
    ' 3. Add created section to report's section collection
    reportObj.Sections.Add(section)
 
    ' Optional. If you have progress indicator set its Report property to created report
    progressInfo.Report = reportObj
 
	' 4. Generate Preview 
	docViewer.GeneratePreview(reportObj, False, True)
 
	'Optional. Make XamReportPreciew content visible . It is true by default.
	docViewer.IsContentVisible = True
 
    ' 5. Call print method
    DocumentViewer doc  =  docViewer.DocumentViewer
	doc.Focus()
End Sub
Use its properties and methods
private void XamReportPreviewSample()
{

	//initialize controls
	StackPanel stackPanel = new StackPanel();
	stackPanel.Children.Add(XamDataGrid1);
	XamReportPreview docViewer = new XamReportPreview();
	stackPanel.Children.Add(docViewer);
	ReportProgressControl progressInfo = new ReportProgressControl();
	stackPanel.Children.Add(progressInfo);
	
	Window1.Content = stackPanel;

    // 1. Create Report object
    Report reportObj = new Report();

    // 2. Create EmbeddedVisualReportSection section. 
    // Put the grid you want to print as a parameter of section's constructor
    EmbeddedVisualReportSection section = new EmbeddedVisualReportSection(XamDataGrid1);

    // 3. Add created section to report's section collection
    reportObj.Sections.Add(section);

    // Optional. If you have progress indicator set its Report property to created report
    progressInfo.Report = reportObj;
	
	// 4. Generate Preview 
	docViewer.GeneratePreview(reportObj, false, true);
	
	//Optional. Make XamReportPreciew content visible . It is true by default.
	docViewer.IsContentVisible = true;
	
    // 5. Call print method
    DocumentViewer doc = docViewer.DocumentViewer;
	doc.Focus();
}
Create XamReportPreview control in xaml.
<Page  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
       
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       
xmlns:igRep="http://infragistics.com/Reporting"  

>

    
<igRep:XamReportPreview x:Name="reportPreview" Width="200"/>

</Page>
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also