-1

I want change font style in RichTextBox sp. I working in WPF.

sp.FontStyle = FontStyle.Bold;

Error say: System.Windows.FontStyle' does not contain a definition for 'Bold' I don't know, how to change, if this start working.

Nejc Galof
  • 2,538
  • 3
  • 31
  • 70

1 Answers1

1

You need to set Bold in FontWeight-property:

sp.FontWeight = FontWeights.Bold;

Same in WinForms:

sp.Font = new Font(sp.Font.Name, sp.Font.Size, FontStyle.Bold); 
W0lfw00ds
  • 2,018
  • 14
  • 23