As of July 2017, you can now view reports and document objects like FlexReports, PDFs, and SSRS documents with FlexViewer for WPF. FlexViewer has already launched for WinForms, UWP, and ASP.NET MVC.

We'll walk through how to:



Loading FlexReport in FlexViewer


Step 1: Create a WPF Application and name it FlexReportSample.

Step 2: Drop C1FlexViewer on the form.

Step 3: Add a reference to C1.WPF.FlexViewer.4 in the application.

Step 4: Create a resources folder and add a .flxr FlexReport (for example, add FlexCommonTasks_XML.flxr).

Step 5: In the XAML code, set the following properties for FlexViewer:


<c1:C1FlexViewer x:Name="fv" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ZoomMode="PageWidth"/>


Step 6: Go to the MainPage_Loaded event in the code-behind.

Step 7: Paste the following code in the event:


Assembly asm = Assembly.GetExecutingAssembly();
Stream _reportStream = asm.GetManifestResourceStream("FlexReportSample.Resources.FlexCommonTasks_XML.flxr");
_flexReport.Load(_reportStream, "Simple List");
fv.DocumentSource = _flexReport;


FlexViewerForWPF


Loading a PDF in FlexViewer


Step 1: Create a WPF Application and name it PDFDocumentSourceSample.

Step 2: Drop C1FlexViewer on the form.

Step 3: Create a resources folder and add a PDF file (for example, add Invoice.pdf).

Step 4: In the XAML code, set the following properties for FlexViewer:


<c1:C1FlexViewer x:Name="fv" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ZoomMode="PageWidth"/>


Step 5: Go to the MainPage_Loaded event in the code-behind.

Step 6: Paste the following code in the event:


C1PdfDocumentSource pdfDocumentSource = new C1PdfDocumentSource();
using (Stream stream = this.GetType().Assembly.GetManifestResourceStream(@"PdfDocumentSourceSample.Resources.Invoice.pdf"))
pdfDocumentSource.LoadFromStream(stream);
fv.DocumentSource = pdfDocumentSource;


PDFInWPFFlexViewer


Loading an SSRS Document in FlexViewer


Step 1: Create a WPF Application and name it SSRSDocumentSourceSample.

Step 2: Drop C1FlexViewer on the form.

Step 3: In the XAML code, set the following properties for FlexViewer:


<c1:C1FlexViewer x:Name="fv" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ZoomMode="PageWidth"/>


Step 5: Go to the MainPage_Loaded event in the code-behind.

Step 6: Paste the following code in the event:



System.Net.NetworkCredential  _credential = new System.Net.NetworkCredential("ssrsUserName", "ssrsPassword", "");
C1SSRSDocumentSource _ssrsDocSource = new C1SSRSDocumentSource();
_ssrsDocSource.Credential = _credential;
_ssrsDocSource.DocumentLocation = new SSRSReportLocation(_ssrsServerUrl, "AdventureWorks/Product Catalog");
fv.DocumentSource = _ssrsDocSource;



SSRS

With FlexViewer for WPF, you can also:


  • Add your inputs in the parameter panel

  • Select and copy text to share details

  • Refresh reports and cancel document loading

  • Print your reports and documents with print support

  • Use page setup and portrait/landscape settings for your reports

  • Choose from standard zoom options like Actual Page, Page Width, Whole Page, and Custom Zoom

  • Display reports in multiple page layouts: single, continuous, and facing pages

  • Rotate your reports/documents with the Rotate option

  • Navigate through thumbnails, outlines, hyperlinks, text search, and page navigation options

  • Export documents to standard export formats



Learn more about FlexViewer.