0

Is this possible to stylize text in Label/Button/TextBlock in WPF? I mean something like making one word Bold and another Italic? In android it looks like this https://medium.com/androiddevelopers/styling-internationalized-text-in-android-f99759fb7b8f but I can't find any equivalent in WPF

1 Answer 1

3

Yes, it is possible

  <TextBlock.Inlines>
    <Run FontWeight="Bold" FontSize="12" Text="I am bold" />
    <Run FontStyle="Italic" Text="I am italic" />
    <Run TextDecoration="Underline" Text="I am underlined" />
    <Run ForeGround="Yellow" Text="I am yellow" />
  </TextBlock.Inlines>
Sign up to request clarification or add additional context in comments.

2 Comments

Okay, so another question. Is it possible to write text in resx file which ll behave like Your text? Eg. "<b> I am bold </b> <i> I am italic <\i>"
Yes, you can do this via binding stackoverflow.com/questions/30551372/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.