Reputation: 195
I have created a TextBlock which contains both hardcode text and the binding text.
I want the binding text to be displayed in bold and hardcode text without bold.
<DataTemplate>
<StackPanel Orientation="Vertical" HorizontalAlignment="Left">
<TextBlock Text="{Binding Vendor, StringFormat='Vendor: {0}'}" FontWeight="Medium"/>
<TextBlock Text="{Binding Model, StringFormat='Brand: {0}'}" FontWeight="Medium"/>
<TextBlock Text="{Binding Description, StringFormat='Description: {0}'}" FontWeight="Medium"/>
<TextBlock Text="{Binding Material, StringFormat='Material: {0}'}" FontWeight="Medium"/>
<TextBlock Text="{Binding Color, StringFormat='Color: {0}'}" FontWeight="Medium"/>
<TextBlock Text="{Binding Size, StringFormat='Size: {0}'}" FontWeight="Medium" Visibility="{Binding SizeVisible}"/>
<TextBlock Text="{Binding Price, StringFormat='Price: {0}'}" FontWeight="Medium"/>
</StackPanel>
</DataTemplate>
Upvotes: 1
Views: 150
Reputation: 35730
you can make two inline Run
blocks:
<TextBlock>
<Run Text="Vendor:"/>
<Run Text="{Binding Vendor, Mode=OneWay}" FontWeight="Bold"/>
</TextBlock>
Upvotes: 2