我为 TexBlock 控件定义了一个样式资源。我试图将它的 TextTrimming 属性分配为“WordEllipsis”。问题是结果是一个空白文本,而不是一些带有点的字符串。
这是我的风格资源:
<DataTemplate x:Key="ItemTemplate">
<Grid Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="120" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="{Binding Status, Converter={StaticResource ContactStatusToColorConvertor}}" BorderThickness="7" CornerRadius="90">
<Image Source="{Binding ImageUrl, Converter={StaticResource StringToAssetUrlConverter}}" Width="120" Height="120" HorizontalAlignment="Center" Stretch="Fill">
<Image.Clip>
<EllipseGeometry Center="60,53" RadiusX="50" RadiusY="50" />
</Image.Clip>
</Image>
</Border>
<!--<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Left" Height="30">-->
<Border Grid.Row="1" BorderThickness="2" Height="30">
<TextBlock Text="A very loong name" Style="{StaticResource AWTextBlockNormalStyle}" Height="30" TextTrimming="WordEllipsis" TextWrapping="NoWrap"/>
</Border>
<!--<TextBlock Text="{Binding LastName}" Margin="3,0,0,0" Style="{StaticResource AWTextBlockNormalStyle}" TextTrimming="WordEllipsis" />-->
<!--</StackPanel>-->
</Grid>
</DataTemplate> ##