CrystalReportViewer is a Windows Forms control, you can use
WPF/Windows Form interop technology to integrate the viewer into the
WPF application. Here is the steps you can do.
1. Add a reference to the CrystalDecisions.Windows.Forms.dll.
2. Add a namespace mapping in XAML.
3. Use WindowsFormsHost to host the CrystalReportViewer control.
Sample code:
<Window
x:Class=”ForumProjects.MainWindow”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
xmlns:crystal=”clr-namespace:CrystalDecisions.Windows.Forms;assembly=CrystalDecisions.Windows.Forms”
Title=”MainWindow” Width=”800″ Height=”600″>
<WindowsFormsHost>
<crystal:CrystalReportViewer x:Name=”MyCrystalReportViewer” Width=”300″ Height=”300″/>
</WindowsFormsHost>
</Window>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
// reference CrystalReportViewer in code behind
this.MyCrystalReportViewer.BackColor = System.Drawing.Color.AliceBlue;
}
}