XAML: How do I make part of a GroupBox Header bold?

4.2k views Asked by At

I need to make the first part of a GroupBox Header bold, and the other part non-bold. Here is the goal I'm trying to achieve:

Students (Max: 32)

        <GroupBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" Margin="40, 80, 40, 80">
        <GroupBox.Header>
            <Span FontWeight="Bold">Students</Span>
            (Max: 32)
        </GroupBox.Header>
        <StackPanel>
        ...

This gives me the error: The property "Header" is set more than once.

I know that it works for TextBlocks, but I can't make it happen for GroupBox Headers:

        <TextBlock>
            <Span FontWeight="Bold">Students</Span>
            <Span>(Max: 32)</Span>
        </TextBlock>

Thanks.

2

There are 2 answers

2
15ee8f99-57ff-4f92-890c-b56153 On BEST ANSWER
<GroupBox.Header>
    <TextBlock>
        <Span FontWeight="Bold">Students</Span>
        <Span>(Max: 32)</Span>
    </TextBlock>
</GroupBox.Header>
0
dman On
 <GroupBox.Header>
                <TextBlock>
                    <Span FontWeight="Bold">Students</Span>
                    <Span>(Max: 32)</Span>
                    </TextBlock>
            </GroupBox.Header>