WPF中使用winform 控件
原来有一个WINFORM项目的功能模块希望集成到新的WPF项目中,怎样集成才最简单? 思路:将原来的WINFORM项目类型改为WindowsFormsControlLibrary类型就OK了。 步骤: 1、所以我们就直接建立一个WindowsFormsControlLibrary项目吧!接着我在该项目中新增Windows Form,为Form1。也就是将原来的项目类型改造为WindowsFormsControlLibrary项目。 2新建Wpf项目 (1)、添加两个引用:WindowsFormsIntegration.dll(负责整合WPF和Windows)、System.Windows.Forms. ( 2)、在 XAML文件中添加两个引用(粗体部分): <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:WinFormHost="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"