Here iam using a single text block to show comma seperated string (PII, Public, SPI)
Now i want different colors for each value in that string
Ex : PII - Blue, Public - Green, SPI - Red
Is there any way to get this in a single text block
No, a single TextBlock can draw its text using only its TextBlock.stroke Brush.
I would split it up into three TextBlocks in a “Horizontal” Panel.
But there are at least two other possibilities:
Use a LinearGradient Brush with color stops at the appropriate fractions so that each section is drawn in the desired color. The hard part is computing those fractions correctly by measuring the width of each section.
Render HTML into a Picture: Rich Text Rendering. The downside is that this is dramatically slower in time and bigger in memory usage.