I'm using StringFormat to show some bound data and works fine.
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="Name {0} | Id ({1})">
<Binding Path="Name" />
<Binding Path="Id"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
I want the Id
value (see XAML) to be bold. How to do this?
Use Run
(and/or Bold
) elements inside the TextBlock
instead of it's Text
property, you can bind and style them separately.
e.g.
<TextBlock>
<Run Text="Name "/><Run Text="{Binding Name}"/>
<Run Text=" | "/>
<Run Text="Id ("/><Run Text="{Binding Id}" FontWeight="Bold"/><Run Text=")"/>
</TextBlock>
alternatively to <Run Text="{Binding Id}" FontWeight="Bold"/>
:
<Bold><Run Text="{Binding Id}"/></Bold>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With