I have a problem with a WPF control that I'm trying to host in an ElementHost in a WinForms app. The control is a lookless custom control that I originally developed in a separate test project, which was a WPF app. In there it obviously works fine, but in my WinForms app all I get is a blank grey box where the ElementHost is displayed.

Here's my C# code for creating, populating, and adding the ElementHost to the parent Control:

// This is my WPF control
m_TabHostPanel  = new TabHostPanel();
m_ElementHost  = new ElementHost
                 {
                     Child = m_TabHostPanel,
                     Dock = DockStyle.Top,
                     Height = 34
                 };
this.Controls.Add( m_ElementHost );

The parent control contains other WinForms controls that are added and removed at runtime, as needed. These are all hosted singly with their Dock set to DockStyle.Fill. Thus, every time I add one I send the ElementHost to the back of the Z-order to make sure it renders correctly:

m_ElementHost.SendToBack();

Thus, I know I'm not running into an airspace problem, or anything like that.

The one thing I did wonder about is this: in the original project the styles for all my lookless controls were merged into the resource dictionary for the application in App.xaml, like this:

<Application x:Class="WpfTestApp.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Application/UserInterface/DataTemplates/TabModelDataTemplate.xaml"/>
                <ResourceDictionary Source="Application/UserInterface/Styles/HoverablePressableButtonStyle.xaml
Edit
Report