Hi,
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:
<UserControl x:Class="MyControls.MediaPlayer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:windowsformscontrols="clr-namespace:MyWindowsForms.Controls;assembly=MyWindowsForms.Controls" mc:Ignorable="d" Width="Auto" Height="Auto"> <Grid Margin="2,2,2,2"> <WindowsFormsHost> <windowsformscontrols:WMPControl x:Name="WindowsMediaPlayer"/> </WindowsFormsHost> </Grid> </UserControl>
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,
Geir
