Problems hosting a WinForms control in a ToolWindow

Docking/MDI for WPF Forum

Posted 12 years ago by Geir Schjorlien
Version: 11.2.0554


In my WPF application, I have a WinForms user-control containing Windows Media Player. In addition I have a WPF user-control containing the WinForms media-player control like this:

   Width="Auto" Height="Auto">

   <Grid Margin="2,2,2,2">
         <windowsformscontrols:WMPControl x:Name="WindowsMediaPlayer"/>

I'm hosting this media-player control in a ToolWindow like this:

MediaPlayerWindow = new ToolWindow(MyDockSite, "MediaPlayerWindow", "Media Player", null, new MyControls.MediaPlayer());
MediaPlayerWindow.CanRaft = true;
MediaPlayerWindow.CanDockBottom = false;
MediaPlayerWindow.CanDockLeft = false;
MediaPlayerWindow.CanDockRight = false;
MediaPlayerWindow.CanDockTop = false;
MediaPlayerWindow.CanBecomeDocument = false;

My problem is that when the "MyControls.MediaPlayer" is hosted in a ToolWindow, it becomes "invisible". The window just shows a white background. I know that the control is there because I get the Windows Media Player tooltips when moving the mouse over the ToolWindow. The "MyControls.MediaPlayer" control displays normally when hosted in other "normal" windows. I also created a simpler WinForms user-control containing just a button, but got the same behavior.

So my question: Do you know of any problems hosting a "WindowsFormsHost" in a ToolWindow?

Kind regards,


Comments (1)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Geir,
The problem you are having is most likely because of the settings required for compatibility with interop controls. You can read more extensively about this in the documentation under Docking & MDI > Interoperability > WinForms Compatibility. Your issue is probably caused by the AllowsTransparency property needing to be false in order for interop controls to function correctly. If you follow the directions in the documentation to set up compatibility the property will automatically be set to false though.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.