Controls don't show over Winforms Host
Asked Answered
H

1

2

I am trying to load a swf file as background for my WPF window. For this I have used a WinformHost and I load the swf movie in the Winform host using the plugin AxShockwaveFlashObjects.

<Grid>
    <WindowsFormsHost Name="wfh">
        <ax:AxShockwaveFlash x:Name="axFlash"/>
    </WindowsFormsHost>
</Grid>

Till here the application works fine. However when I add my other controls(buttons,textblocks etc) to the Grid, they dont show. All I see is just the movie. Any pointers please.

Hanghangar answered 4/11, 2011 at 7:28 Comment(2)
How do you add other controls to the grid? Can you show some code?Osswald
This is typically referred to as an "airspace" issue -- you can find out lots more by Googling for WPF and airspace.Seraphine
C
5

This is actually expected since the WPF elements are all rendered within a single HWND (that of the WPF Window in this case) and therefore are below the WindowsFormsHost (or any other HwndHost). This is discussed here in MS' documentation and also here.

In theory this will be supported by some new functionality being added to .NET 4.5 - via the IsRedirected property of the HwndHost. This is discussed in some of the preview documentation for 4.5 here.

Continence answered 4/11, 2011 at 14:5 Comment(2)
IsRedirected was only available in Beta, did't make it to final release.Brandenburg
As @Brandenburg mentioned the IsRedirected feature was cut so HwndHosts like WindowsFormsHost will always be above WPF elements. If you needed something floating above or something then maybe you can use a Popup as that is a separate top level (topmost) window but you won't get a sibling WPF element above the HwndHost.Continence

© 2022 - 2024 — McMap. All rights reserved.