Pergunta

I have a Windows Forms application in which I host a usercontrol created with WPF. This is done using the Element Host class. All WPF elements in the element host container inherit the windows forms style, including fonts, etc.

I want to prevent that from happening. All elements should inherit the default WPF style, so the fonts (and other styles) are the same. How can I achieve that?

I do not want to set all defaults myself.

Example Window Example Window, note the difference between the 'g' in 'segeo' and 'S' in 'MS Sans Serif'

Foi útil?

Solução

Found it:

Just add:

this.InheritanceBehavior = InheritanceBehavior.SkipToAppNext;

to your constructor of your UserControl.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top