How could I add WPF controls over a WindowsFormsHost (I already know that when I add a Child to WFH, it becomes a separated handle). I tried making it a separated StackPanel or Canvas but doesn't seem's to work:
class CustomCanvas : Canvas{
public CustomCanvas(/*Some Width, Height, path values received*/){
WindowsFormsHost _AnimatedBckgr = new WindowsFormsHost()
{
Width = _wdt,
Height = Container_Height,
Margin = new Thickness(0,0,0,0),
Child = new System.Windows.Forms.Panel()
};
((System.Windows.Forms.Panel)_AnimatedBckgr.Child).Controls.Add(new System.Windows.Forms.PictureBox()
{
//Width = (int)_wdt, Height = (int)Container_Height,
Dock = System.Windows.Forms.DockStyle.Fill,
BackgroundImage = new System.Drawing.Bitmap(GifAnimatedFilePath),
BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch,
});
//StackPanel or Canvas wndHost;
wndHost = new StackPanel() { Width = _wdt, Height = Container_Height };
wndHost.Children.Add(_AnimatedBckgr);
Children.Add(wndHost);
//Anything added in this canvas doesn't appears over the wndHost
Children.Add(new Button(){ Content = "Hi" });
}
}
Is there any other way to add WPF controls over the WindowsFormsHost without using the hacky transparent Windows hack? Thanks.




Image()cannot play animated GIF's in background, instead I could use aMediaPlayer()orMediaTimeline()to make this move, but I don't want my program to keep consuming over 20% CPU in just playing aMediaelement permanently. If I use a PictureBox it can play a GIF smooth and faster than WPF'sMediaPlayer()and this is played by default (Set Background path, done.)PictureBox; but then you want to superimpose WPF elements on top of that? If so I don't think it is possible. WPF has a single rendered window as opposed to native Windows and WinForms. I once hosted the WinForms Chart control and was unable to have WPF things in front of the Z-order of the chart