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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With