C1ReportViewer Quick Start > Step 2 of 3: Adding Content to the C1ReportViewer Control |
In the previous step you created a WPF application and added the C1ReportViewer control to your project. In this step you'll add PDF content to the C1ReportViewer control. Note that in this step you will add a PDF file that is included with the WPF Edition samples, which are by default installed in the Documents or MyDocuments folder in the Documents\ComponentOne Samples\WPF or Documents\ComponentOne Samples\Silverlight directory. If you choose, you can instead use another PDF file and adapt the steps. To customize your project and add a PDF file to the C1ReportViewer control in your application, complete the following steps:
Visual Basic |
Copy Code
|
---|---|
Imports C1.WPF.ReportViewer
|
C# |
Copy Code
|
---|---|
using C1.WPF.ReportViewer;
|
Visual Basic |
Copy Code
|
---|---|
Public Sub New() InitializeComponent() Dim resource = Application.GetResourceStream(New Uri("QuickStart;component/C1XapOptimizer.pdf", UriKind.Relative)) Me.C1ReportViewer1.LoadDocument(resource.Stream) End Sub |
C# |
Copy Code
|
---|---|
public MainPage() { InitializeComponent(); var resource = Application.GetResourceStream(new Uri("QuickStart;component/C1XapOptimizer.pdf", UriKind.Relative)); this.C1ReportViewer1.LoadDocument(resource.Stream); } |
This code adds a stream and loads the stream into the C1ReportViewer control. Note that if you named the application differently, you will need to replace "QuickStart" with the name of your project. If you added a different PDF file, replace "C1XapOptimizer.pdf " with the name of your file.
If you run the application now, it will appear in the content window within the C1ReportViewer control:
In this step you added content to the C1ReportViewer control. In the next step you'll view some of the run-time interactions possible in the control.