문제

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'

도움이 되었습니까?

해결책

Found it:

Just add:

this.InheritanceBehavior = InheritanceBehavior.SkipToAppNext;

to your constructor of your UserControl.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top