问题1:
WPF中在使用WindowsFormsHost调用WinFrom控件时,若在WindowsFormsHost上层添加了WPF控件,该控件不会显示出来。
<Grid>
<WindowsFormsHost Background="White">
<Winfrm:WebBrowser x:Name="WinFrmWebBrowser"/>
</WindowsFormsHost>
<!--运行时 Ellipse 不会显示出来-->
<Ellipse Width="100" Height="100" Fill="Red"/>
</Grid>
解决方案: 使用Popup对上层的WPF控件内容进行包装。
<Style TargetType="{x:Type local:MyBrowser}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MyBrowser}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"