Setting a button's text to have some bold characters in WPF
Use a TextBlock
to hold the formatted text:
<Button>
<TextBlock>Hey <Bold>you</Bold>!!!</TextBlock>
</Button>
Per your comment, if you want to be explicit about the fact that this sets the Content
property, you can use XAML property element syntax to do so:
<Button>
<Button.Content>
<TextBlock>Hey <Bold>you</Bold>!!!</TextBlock>
</Button.Content>
</Button>
However this is redundant because Button
has a ContentPropertyAttribute
which makes the first version exactly equivalent to the second anyway.
This will work.
<Grid>
<Button Name="button1" Width="40" Height="40"
Content="something" FontWeight="Bold" />
</Grid>
Try <Button><TextBlock>a<Bold>b</Bold>c</TextBlock></Button>
.