1、添加两个引用:WindowsFormsIntegration.dll(负责整合WPF和Windows)、System.Windows.Forms.dll2、在 XAML文件中添加引用(粗体部分):
<Window x:Class="VideoPreview.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" Title="MainWindow" Height="620" Width="560"> < /Window> 3、在XAML编码区实现你想添加的控件:
<WindowsFormsHost Height="304" Width="540" Background="#FF00FF23" Opacity="0.2">
<winForms:PictureBox x:Name="RealPlayWnd" /> </WindowsFormsHost>