Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wpf over activeX

Tags:

c#

wpf

vlc

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.

like image 634
Mitch Avatar asked Mar 06 '13 14:03

Mitch


1 Answers

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.

like image 65
Mitch Avatar answered Sep 28 '22 08:09

Mitch