簡體   English   中英

TextBlock不會顯示所有文本

[英]TextBlock does not show all text

我對TextBlock的問題是它有時會切斷文本。 下圖是其下xaml的輸出。 第一個TextBlock應該包含Défi最大值,但是最后一個m被截斷。 當我更改部分樣式時,它會重新出現,但我需要它完全像這樣。 這可能是什么原因?

如您所見,TextBlock具有足夠的空間,在下圖中,TextBlock周圍的空白為藍色。 第二個TextBlock具有一個額外的字符,該字符使TextBlock正確顯示文本。 (即使其中存在拼寫錯誤;-))

有效的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>

減小字體大小或增加框寬。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM