简体   繁体   中英

TextBlock does not show all text

The problem I have with TextBlock is that it sometimes cuts off text. The image below is the output of the xaml below it. The first TextBlock should contain Défi maximum, but the last m is cut off. I get it to reappear when I change part of the style, but I need it to be exactly like this. What could be the cause of this?

As you can see the TextBlock has enough space, the margin around the TextBlock is blue in the image below. The second TextBlock has an extra character which causes the TextBlock to show the text correctly. (even though there is a spelling error in it ;-) )

有效的XHTML

<Window.Resources>
    <Style TargetType="TextBlock">
        <Setter Property="FontFamily" Value="Candara"/>
        <Setter Property="FontSize" Value="13"/>
        <Setter Property="FontWeight" Value="Regular"/>
        <Setter Property="Padding" Value="5"/>
        <Setter Property="Background" Value="Red"/>
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="TextAlignment"  Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Margin" Value="0"/>
    </Style>

    <Style TargetType="Grid">
        <Setter Property="Width" Value="87"/>
        <Setter Property="Height" Value="87"/>
        <Setter Property="Background" Value="Blue"/>
        <Setter Property="Margin" Value="1"/>
    </Style>
</Window.Resources>

<StackPanel Orientation="Horizontal">
    <Grid>
        <TextBlock>Défi maximum</TextBlock>
    </Grid>
    <Grid>
        <TextBlock>Défi maximume</TextBlock>
    </Grid>
    <Grid>
        <TextBlock>3x10</TextBlock>
    </Grid>
    <Grid>
        <TextBlock>4x10</TextBlock>
    </Grid>
</StackPanel>

减小字体大小或增加框宽。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM