3

TextTrimming が最初の TextBlock では機能し、2 番目の TextBlock では機能しないのはなぜですか? 表示する必要があるテキストの一部である xaml で LineBreaks を使用しています。

コード:

<Window x:Class="WpfApplication2.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Grid VerticalAlignment="Center">
    <StackPanel>
        <TextBlock TextTrimming="WordEllipsis" TextWrapping="Wrap" Width="20" Height="20" Background="Yellow">
            1 2 3 4 5
        </TextBlock>

        <TextBlock TextTrimming="WordEllipsis" TextWrapping="Wrap" Width="20" Height="20" Background="Aqua">
            1
            <LineBreak/>
            2
            <LineBreak/>
            3
            <LineBreak/>
            4
            <LineBreak/>
            5
        </TextBlock>
    </StackPanel>
</Grid>

出力:

ここに画像の説明を入力

4

1 に答える 1