1、怎样在WPF中使用Windows窗体控件(如水晶报表)

我们可以使用WindowsFormsHost元素在WPF中载入一个Windows Forms控件,下面的这个例子展示了如何载入一个CrystalReportViewer元素:

<Window

  x:Class="ForumProjects.MainWindow"

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

  xmlns:c="clr-namespace:CrystalDecisions.Windows.Forms;assembly=CrystalDecisions.Windows.Forms"

  Title="MainWindow" Width="800" Height="600">

    <WindowsFormsHost>

        <c:CrystalReportViewer x:Name="MyCrystalReportViewer" Width="300" Height="300"/>

    </WindowsFormsHost>

</Window>

 

 

参考:http://social.msdn.microsoft.com/Forums/zh-CN/wpfzhchs/thread/857fdaa9-5c67-4e0a-a1fd-037f72577c76