I would like the Content
of my WPF Button
to use multiple colors like, e.g.:
<Button Name="MyButton">
<Blue>This is</Blue>
<Red>Red</Red>
</Button>
I see that I can't use multiple Run
s like in a TextBlock
- what is the proper method for achieving this effect?
You can use TextBlock
as Button.Content
<Button Name="MyButton">
<TextBlock>
<Run Foreground="Blue" Text="This is Blue"/>
<Run Foreground="Red" Text=" This is Red"/>
</TextBlock>
</Button>
Button
is ContentControl
and as such
The ContentControl can contain any type of common language runtime object (such as a string or a DateTime object) or a UIElement object (such as a Rectangle or a Panel)