Domanda

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'

È stato utile?

Soluzione

Found it:

Just add:

this.InheritanceBehavior = InheritanceBehavior.SkipToAppNext;

to your constructor of your UserControl.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top