1

This is my WindowsForm user control. It is using an Infragistics UltraGroupBox. User Control

When I try to host this control in a WPF Window and a WindowsFormsHost, the text "Integrated Security" suddenly wraps and is cut off. Also the "Select Type" text from another user control is cut off on the bottom (notice the y). enter image description here

How do I get my control not to wrap the text when hosted in a WindowsFormsHost since it fits fine (with some space) in the UserControl I'm using? Can anyone explain what is happening?

Darlene
  • 808
  • 5
  • 16
  • I'm wondering if the font in the WinForms control is changing size or style to match the WPF control default font. http://msdn.microsoft.com/en-us/library/ms744952.aspx Might be related to this StackOverflow post... http://stackoverflow.com/questions/4679172/text-renders-differently-on-wpf-window-and-inside-elementhost – Darlene Jul 02 '13 at 14:37

1 Answers1

4

After reading the two posts that I linked to above, I was able to fix my issue by changing the FontFamily and FontSize. Now the font won't match all the other controls in my WPF Window, but the text doesn't wrap and get cut off.

<WindowsFormsHost FontFamily="Microsoft Sans Serif" FontSize="11" x:Name="MyHost" Margin="0,0,0,20" /> 

The key changes are

  • FontFamily="Microsoft Sans Serif"
  • FontSize="11"

Text renders differently on WPF window and inside ElementHost

Community
  • 1
  • 1
Darlene
  • 808
  • 5
  • 16