Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

WPF TextBlock Color for each Character

Writer Matthew Martinez

how to get each character of a textblock of different color in wpf?

1 Answer

Use many different runs:

 <TextBlock FontSize="22"> <Run Foreground="Gold">H</Run> <Run Foreground="Maroon">e</Run> <Run Foreground="Blue">l</Run> <Run Foreground="Orange">l</Run> <Run Foreground="Brown">o</Run> </TextBlock>

This produce the result:enter image description here

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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