locked
Different Styles in one paragraph for RichTextBlock RRS feed

  • Question

  • Hello.

    I have a string line, as example "Hello, my name is Daniel", which have a different styles.

    How I can to add it in paragraph?

    Now i using:

     paragraph.FontStyle = Windows.UI.Text.FontStyle.Italic
    paragraph.Inlines.Add(new Run(){"text text text"});
    RTB.Blocks.Add(paragraph);

    ;

    I tried to add a few Inlines in a paragraph, but each of them is written on a new line, and I need to write one, and in a different style.

    Thursday, September 11, 2014 5:56 PM

Answers

  • very simple! :) set the style at the run:

    paragraph.Inlines.Add(new Run(){ FontStyle = Windows.UI.Text.FontStyle.Italic, Text = "text text text" });


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Thursday, September 11, 2014 6:06 PM

All replies

  • very simple! :) set the style at the run:

    paragraph.Inlines.Add(new Run(){ FontStyle = Windows.UI.Text.FontStyle.Italic, Text = "text text text" });


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Thursday, September 11, 2014 6:06 PM
  • Oh, Thank you. Its really very simle.

    I have another questions. How i can dispaly a bold text in RichTextBlock??

    Friday, September 12, 2014 6:53 AM
  • Hi Danil,

    I would recommend you post a new question about your second problem.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 22, 2014 1:53 AM
    Moderator