Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the FontStyle in code behind in WPF

Tags:

c#

wpf

fonts

How can I change the FontStyle in the code-behind in WPF. I tried this:

listBoxItem.FontStyle = new FontStyle("Italic"); 

and I got error, any idea?

like image 613
John Jerrby Avatar asked Feb 26 '14 06:02

John Jerrby


2 Answers

It was FontStyles.Italic... Use the FontStyles enum to set the value for FontStyle

listBoxItem.FontStyle = FontStyles.Italic;
like image 98
Sankarann Avatar answered Sep 21 '22 15:09

Sankarann


Try this FontStyles.Italic

listBoxItem.FontStyle = FontStyles.Italic;
like image 43
Nagaraj S Avatar answered Sep 20 '22 15:09

Nagaraj S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!