locked
Change text box's font style dynamically RRS feed

  • Question

  • Hi,

    This must be a really simple problem but I can't get rid of it. I have a text box from the name space System.Windows.Controls and I want to change the font style of it dynamically, i.e in the code behind.

    TextBox myTextBox;
    myTextBox.FontStyle = ....?; // How do I change it to italic for example?
    
    

    Regards,
    Fredrik
    Tuesday, May 19, 2009 10:18 AM

Answers

  • it didn't came correctly so i am writing it again

    myTextBox.FontStyle = FontStyles.Italic;

    Cheers,

    Tarun
    Developer
    • Proposed as answer by Tarun Jindal Tuesday, May 19, 2009 11:50 AM
    • Marked as answer by Tao Liang Thursday, May 21, 2009 6:43 AM
    Tuesday, May 19, 2009 11:50 AM

All replies

  • Hi Fredrik,

    your answer will be

    myTextBox.FontStyle = 


    Developer : Please mark the answer as helpful or Answered if founded
     FontStyles
    .Italic;

    Hope it Helps.
    • Proposed as answer by Tarun Jindal Tuesday, May 19, 2009 11:49 AM
    Tuesday, May 19, 2009 11:47 AM
  • it didn't came correctly so i am writing it again

    myTextBox.FontStyle = FontStyles.Italic;

    Cheers,

    Tarun
    Developer
    • Proposed as answer by Tarun Jindal Tuesday, May 19, 2009 11:50 AM
    • Marked as answer by Tao Liang Thursday, May 21, 2009 6:43 AM
    Tuesday, May 19, 2009 11:50 AM
  • Thanks a lot Tarun! It was even easier than I thought. I missed the FontStyles class so I got stuck in the FontStyle property instead and tried to find the solution there.
    Tuesday, May 19, 2009 12:12 PM
  • Hi Fredrik,

    If your question has been answered can you please mark my posts as answered and helpful.
    That would be appreciated.

    Thanks a lot.
    Developer
    Tuesday, May 19, 2009 12:18 PM