Reputation: 20764
In my application I have a control that displays hex data:
I want to color code the different bytes. Currently I use a TextBlock
for displaying the hex data, I dont think it is possible to color the individual bytes differently with that.
So my question is: Which control do I have to use to color code the text?
Are there any other means to achieve such a color coding?
Upvotes: 1
Views: 153
Reputation: 18000
Try this
<Label>
<StackPanel Orientation="Horizontal">
<TextBlock Background="Red" Text="S"/>
<TextBlock Background="Blue" Text="O"/>
</StackPanel>
</Label>
Upvotes: 0
Reputation: 38434
Consider using a TextBlock, but break the elements up using Run blocks, e.g.
<TextBlock>
<Run Background="Red">A</Run>
<Run Background="Blue">B</Run>
</TextBlock>
Upvotes: 3