WPF. Can I dinamically make part of the TextBlock.Text to different colour?
Posted
by Bobb
on Stack Overflow
See other posts from Stack Overflow
or by Bobb
Published on 2010-05-23T12:37:02Z
Indexed on
2010/05/23
12:40 UTC
Read the original article
Hit count: 221
I have TextBlock in my main form. I set the Text property to different strings during the application run.
I would like to be able to colour parts of particular strings.
Say (pseudo-code)
if(a < 0) txbStatus.Text = string.Format("{0} <RED>{1}</RED>", a, b);
else txbStatus.Text = string.Format("{0} <BLUE>{1}</RED>", a, b);
© Stack Overflow or respective owner