Wpf – Problem Inserting Report Viewer into WPF Application using WindowsformsHost

formsintegrationreportviewerwindowswpf

I am trying to create a popup from my WPF application which shows a report viewer hosted in a WindowsFormsHost
however I am having problems with the following Xaml

<Page x:Class="FIS3.ReportViewer.ReportViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
Title="MapViewer">
<Grid>
    <my:WindowsFormsHost>

    </my:WindowsFormsHost>
    <Label Name="exampleText" Content="this is the Report Viewer ..." />
</Grid>

I am getting a build error notifying me that
"The type 'my:WindowsFormsHost' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built"

have I made an error in my XAML
I have added WindowsFormsIntegration as a reference to my project.

Thanks for your help

Col

Best Answer

There is a second solution to this that people seem to have overlooked. I scratched my head on this one for a good 20 minutes. No solution, including this one, would work. Turns out the solution for me was to add:

WindowsFormsIntegration

to my references

after I realized that based on:

http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.windowsformshost.aspx

that this uses the WindowsFormsIntegration.dll. It seemed to have been missing from my references.

Hope this helps!