I would like to apply the TextTrimming (CharacterEllipsis) property to the text in the WPF DataGrid cells.

I applied my own DataGridCell template, as in this answer (code below), and it works well, except for the hyperlink columns such as the first in the picture), which are now empty.

<Style TargetType="DataGridCell">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border Padding="3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<ContentPresenter.ContentTemplate>
<DataTemplate>
<TextBlock TextTrimming="CharacterEllipsis" Text="{Binding Text}"/>
</DataTemplate>
</ContentPresenter.ContentTemplate>
</ContentPresenter>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
I see the difference in both types of columns in the visual tree:

but I don’t understand how I can use this information to apply TextTrimming columns to both types of TextBlocks. Thank you for your time;)
source
share