简体   繁体   English

WebBrowser上的MediaElement

[英]MediaElement over WebBrowser

I have WPF Application with this Grid : 我有这个Grid WPF应用程序:

    <Grid Name="MiddleGrid" Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

        <WebBrowser Name="Browser" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" />
        <MediaElement Name="Media" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" LoadedBehavior="Manual" UnloadedBehavior="Stop"/>
    </Grid>

And i want to make the MediaElement control to be over the Browser. 我想让MediaElement控件在浏览器上。 Any help how i should do it? 任何帮助我应该如何做到这一点?

This is a problem with how the web browser control is implemented, and you'll see the same thing if you try to embed Windows Forms controls in a WPF control as well. 这是如何实现Web浏览器控件的问题,如果您尝试在WPF控件中嵌入Windows窗体控件,您将看到同样的事情。 Things which are not native WPF ( WebBrowser is provided by the IE rendering engine, with a WPF wrapper) don't participate in WPF compositing - they're child windows, not WPF controls which participate in the WPF rendering stack. 不是本机WPF( WebBrowser渲染器由IE渲染引擎提供,带有WPF包装器)的东西不参与WPF合成 - 它们是子窗口,而不是参与WPF渲染堆栈的WPF控件。 The way child windows are rendered is that WPF figures out what area they should occupy, tells them about it and off they go. 渲染子窗口的方式是WPF计算出他们应该占据的区域,告诉他们关于它的信息,然后关闭它们。 What WPF doesn't attempt to do is draw any WPF controls on top of it, because they can't participate in compositing with the contents of the child window underneath. WPF没有尝试做的是在它上面绘制任何WPF控件,因为它们不能参与与下面子窗口的内容的合成。

There's some information around about WPF 4.5 solving this problem (it's called "airspace") but it looks like Microsoft took that out of the final release for some reason (guessing it wasn't ready, since it's a horrendously complicated thing to do if you consider all the stuff WPF can do with render transforms, layout transforms, visual brushes and the like). 有一些关于WPF 4.5解决这个问题的信息(它被称为“空域”),但看起来微软出于某种原因从最终版本中取出了它(猜测它没有准备好,因为如果你这是一件非常复杂的事情考虑WPF可以对渲染变换,布局变换,可视化画笔等做的所有事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM