Pine
Pine

Reputation: 104

GroupBox header text is cut off

I'm trying to make a GroupBox in XAML that houses three RadioButtons. Everything looks fine except that the 'g' in my GroupBox header is cut off at the bottom, like this:

Screenshot one

I've read other posts with formatting issues, and have steered clear of positioning my different elements using margins. However, this doesn't seem to be my problem. I have built everything using grids (even inside my GroupBox), but something is still cutting my header off. Any input would be appreciated!

This is what the GroupBox looks like when the font is normal and not bold:

Screenshot two

Here is the part of my code with the GroupBox:

<Grid Grid.Row="1">
                <GroupBox Header="Current Units (English)" HorizontalAlignment="Stretch" Name="currentUnitsGroupBox" VerticalAlignment="Stretch" FontSize="12" FontWeight="Bold">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="6" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="4" />
                        </Grid.RowDefinitions>
                        <Grid Grid.Row="1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width=".22*" />
                                <ColumnDefinition Width=".22*" />
                                <ColumnDefinition Width=".22*" />
                                <ColumnDefinition Width=".36*" />
                            </Grid.ColumnDefinitions>
                            <RadioButton 
                                Content="System" 
                                HorizontalAlignment="Stretch" 
                                Name="systemRadio" 
                                VerticalAlignment="Center" 
                                FontSize="12" 
                                FontWeight="Bold" 
                                IsChecked="True" 
                                Grid.Column ="0" 

                                AutomationProperties.AutomationId="CurrentUnitsSystem"/>
                            <RadioButton 
                                Content="English" 
                                FontSize="12" 
                                FontWeight="Bold" 
                                HorizontalAlignment="Stretch" 
                                Name="englishRadio" 
                                VerticalAlignment="Center" 
                                Grid.Column="1" 

                                AutomationProperties.AutomationId="CurrentUnitsEnglish"/>
                            <RadioButton 
                                Content="Metric" 
                                FontSize="12" 
                                FontWeight="Bold" 
                                HorizontalAlignment="Stretch" 
                                Name="metricRadio" 
                                VerticalAlignment="Center" 
                                Grid.Column="2" 

                                AutomationProperties.AutomationId="CurrentUnitsMetric"/>
                        </Grid>
                    </Grid>
                </GroupBox>
            </Grid>

Upvotes: 8

Views: 2871

Answers (2)

Trampa
Trampa

Reputation: 1

Try this:

<GroupBox HorizontalAlignment="Stretch" Name="currentUnitsGroupBox" VerticalAlignment="Stretch" FontSize="12" FontWeight="Bold">

        <GroupBox.Header>
            <TextBlock Text="Current Units (English)" Padding="5"  />
        </GroupBox.Header>

    </GroupBox>    

Upvotes: 0

lokusking
lokusking

Reputation: 7456

I've tested it with everything that came to my mind and im not able to reproduce it. Please try the following:

<GroupBox FontSize="12" FontWeight="Bold"> 
    <GroupBox.Header> 
           <TextBlock Height="22" Text="Current Units (English)"/>     </GroupBox.Header>

Since the Header in the GroupBox is a TextBlock anyway, we do the stuff now by ourself and adjust the height a little bit

Upvotes: 10

Related Questions