0

I have a WPF control in an ElementHost on a WinForms form. I've added the Form to a DockPanel Suite pane. The WPF content displays correctly when the Form is floating, or docked left/right/top/bottom, but when DockState is Document the WPF content disappears, leaving a blank docked Form.

I've experimented with creating empty test WPF controls, and this behaviour occurs whenever an ElementHost is used on a WinForm, and docked using DPS. Can anyone suggest where to look for a fix ? I've set the WPF rendering to Software only, but it doesn't help with this problem.

Many thanks.

WinForms App using .NET 4.0, VS2012 on Windows 7 on VMWare Fusion on MacBook Pro.

Jack Welch
  • 115
  • 6
  • This may be related to sizes. winforms doesn't support resolution independence so you have to size stuff manually. Make sure the WPF content and the ElementHost itself is sized properly. – Federico Berasategui Aug 22 '13 at 16:47
  • Right, now fixed. The problem wan't the sizing, or even the WPF, although checking up on how the control was being sized put me on the right track. – Jack Welch Aug 23 '13 at 16:11
  • If you found a solution for your problem, please post it as an answer here for future references – Federico Berasategui Aug 23 '13 at 16:12

1 Answers1

0

After much poking around, the problem turned out to be due to a ToolStripContainer that was on the same form as the DPS DockPanel. When the ElementHost form was docked as document, this was being rendered over the top of it. I replaced the ToolStripContainer with a separate ToolStrip and MenuStrip (following the DockSample), and all works fine.

Jack Welch
  • 115
  • 6