Mitch
Mitch

Reputation: 191

wpf over activeX

I am trying to overlay buttons on a WindowsFormsHost that contains an activeX control embedding VLC. The issue I have is that activeX is always on top of wpf. Are there any ways to get a wpf control over the activeX control?

The VLC control also does not seem to support rendering to a bitmap.

Upvotes: 5

Views: 1491

Answers (3)

Mitch
Mitch

Reputation: 191

For the case of VLC, there is VideoLan.Net available at: http://vlcdotnet.codeplex.com/ which allows for video to be output to an Image.

Upvotes: 0

Mitch
Mitch

Reputation: 191

I finally found a solution. The popup primitive is also an element that is always on top and can be placed over the vlc control. Its a bit of a hack, but it gets the overlay that I needed. My xaml for the player looks like this

<grid>
    <WindowsFormsHost x:Name="Host"
                      Height="200"
                      Width="200" />
    <Border x:Name="Anchor"
            Height="0"
            Width="0"
            HorizontalAlignment="Left"
            VerticalAlignment="Top" />
    <Popup Width="{Binding ElementName=Host,Path=Width}"
           Height="{Binding ElementName=Host,Path=Height}"
           PlacementTarget="{Binding ElementName=Anchor}"
           AllowsTransparency="True"
           IsOpen="True">
        <Border Background="#30808080"
                Width="{Binding ElementName=Host,Path=Width}"
                Height="{Binding ElementName=Host,Path=Height}">
            <Button Content="Start"
                    Height="20"
                    Width="60"
                    Click="button1_Click"/>
        </Border>

    </Popup>
</grid>

The above puts a light grey transparent layer over the vlc player that contains a button. The above doesn't account for if the window is resized or moved, but the issue of putting something wpf over the control has been solved.

Upvotes: 4

Fede
Fede

Reputation: 44068

Short answer: No.

Extracted from MSDN:

In a WPF user interface, you can change the z-order of elements to control overlapping behavior. A hosted Windows Forms control is drawn in a separate HWND, so it is always drawn on top of WPF elements.

Upvotes: 2

Related Questions