开发者

How can I change the color of each character in a textblock

开发者 https://www.devze.com 2023-01-20 13:12 出处:网络
I am writing a little diff tool and need to be able to change the color of a character depending on if its the same, added, removed.What would be the best way to handle this? 开发者_StackOverflow中文版

I am writing a little diff tool and need to be able to change the color of a character depending on if its the same, added, removed. What would be the best way to handle this? 开发者_StackOverflow中文版 Is a textblock a good control to start with?


You can use the Run tag.

<TextBlock><Run Foreground="Red">T</Run>ex<Run Foreground="Green">t</Run></TextBlock>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号