.Net5 WPF 使用 WindowsFormsHost

(1)csproj文件添加

<UseWindowsForms>true</UseWindowsForms>
如图: .Net5 WPF 使用 WindowsFormsHost 添加前后框架对比 .Net5 WPF 使用 WindowsFormsHost

(2)WPF窗口引入命名空间

xmlns:wfh="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:wfc="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"

(3)使用

<Grid Grid.Row="1" Background="Black">
    <!--<ContentControl Content="{Binding VideoWind}" />-->
    <WindowsFormsHost VerticalAlignment="Center" Height="300" Width="350" HorizontalAlignment="Center" Margin="10">
        <wfc:Panel x:Name="ctrVideo" BackColor="gray" Dock="Fill" />
    </WindowsFormsHost>
</Grid>

 

上一篇:Windows7配置GPU和Theano编程环境


下一篇:ubuntu 12.04 "系统的网络服务与此版本的网络管理器不兼容