Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 944
MrProgrammer Avatar asked Feb 05 '23 11:02

MrProgrammer


2 Answers

<GroupBox.Header>
    <TextBlock>
        <Span FontWeight="Bold">Students</Span>
        <Span>(Max: 32)</Span>
    </TextBlock>
</GroupBox.Header>
like image 141
15ee8f99-57ff-4f92-890c-b56153 Avatar answered Feb 08 '23 22:02

15ee8f99-57ff-4f92-890c-b56153


 <GroupBox.Header>
                <TextBlock>
                    <Span FontWeight="Bold">Students</Span>
                    <Span>(Max: 32)</Span>
                    </TextBlock>
            </GroupBox.Header>
like image 45
dman Avatar answered Feb 08 '23 23:02

dman