Click here to Skip to main content
15,850,753 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to replace System.Drawing.Font Header = new Font(FontFamily.GenericSansSerif,15,FontStyle.Bold);
to WPF font class.

Updated 28-Jan-12 22:50pm
Abhinav S 29-Jan-12 3:50am    
Code tags added.

First of all, the notion of "difference" is totally undefined. I don't think you can explain it anyhow.

All you need to understand is that these two classes have nothing to do with each other; they express the same idea in different systems. It's also the best to treat System.Windows.Forms+System.Drawing and WPF as two different parallel words not touching each other.

In fact, there are interoperability modules used to convert images between them, and to host WPF controls in a Form and System.Windows.Forms controls in a WPF Window, but they are monstrous in architecture and implementation; and it's they should better be avoided unless there is some desperate need.

Share this answer
Abhinav S 29-Jan-12 4:25am    
My 5.
Sergey Alexandrovich Kryukov 29-Jan-12 4:51am    
Thank you, Abhinav.
There is no one to one mapping between System.Drawing.Font (WinForms) and System.Windows.Media.FontFamily (WPF).

Have a look at the FontFamily class here[^] and try using it in your own implementation.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900