Is it possible to show ...
if the content of some cell in a DataGrid
is greater than the specified ColumnWidth
?
Something like:
-------------------------------
| Name | Last Name |
-------------------------------
| LongNa.. | |
-------------------------------
TextTrimming
is what you are looking for. Use the DataGridTemplateColumn
and insert a TextBlock
into the CellTemplate
which supports TextTrimming
. Sample -
<DataGrid ItemsSource="{Binding ItemsSourceForYourGrid}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="20">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" TextTrimming="CharacterEllipsis"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>