Skip to main content
You are viewing help content for a version that is no longer maintained/updated.
All docs
V18.2
  • How to: Add a PDF Viewer at Design Time

    • 2 minutes to read

    This example describes how to add a PdfViewerControl to your WPF application at design time within Visual Studio.

    To accomplish this task, perform the following actions:

    • Run Microsoft Visual Studio 2012, 2013, 2015 or 2017.
    • Create a new WPF Application project.
    • Add a PdfViewerControl component to the project.

      To do this, drag the PdfViewerControl from the DX.18.2: Data & Analytics Toolbox tab and drop it onto the main window.

      DragDropControl

    • Right-click the PDF Viewer and select Layout | Reset All to fill the entire window.

      resetlayout_pdf

      After this action, your XAML appears as follows.

      <Window      
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:dxpdf="http://schemas.devexpress.com/winfx/2008/xaml/pdf" 
              x:Class="CreatingPDFViewer.MainWindow"
              Title="MainWindow" Height="350" Width="525">
          <Grid>
              <dxpdf:PdfViewerControl/>
          </Grid>
      </Window>
      

      Note that you can add the PdfViewerControl by overwriting your MainWindow.xaml file with this code without dragging the PdfViewerControl control to the window. However, in this case, you need to manually add references to the following libraries.

      • DevExpress.Data.v18.2.dll
      • DevExpress.Mvvm.v18.2.dll
      • DevExpress.Pdf.v18.2.Core.dll
      • DevExpress.Pdf.v18.2.Drawing.dll
      • DevExpress.Xpf.Core.v18.2.dll
      • DevExpress.Xpf.Docking.v18.2.dll
      • DevExpress.Xpf.DocumentViewer.v18.2.Core.dll
      • DevExpress.Xpf.Grid.v18.2.dll
      • DevExpress.Xpf.PdfViewer.v18.2.dll

      To add references, right-click References in the Solution Explorer and select Add Reference… in the invoked context menu.

      CreatePDFViewer_AddReference

      Note

      Normally, when adding references to these assemblies, you should choose them from the Global Assembly Cache (GAC). However, if you prefer to copy them locally, or need to include them later in your product installation, you can find copies of them in the following directory.

      C:\Program Files (x86)\DevExpress 18.2\Components\Bin\Framework\

      Now, you have a PDF Viewer added to our application.