Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set DataGrid DataGridTextColumn Text Trimming?

Tags:

xml

wpf

I'm looking for examples for building a text-trimming for DataGridTextColumn.

In my current DataGridTextColumn, the text is automatically wrapped and the row width grows. I want to add for that text-trimming.

like image 880
Manikandan Avatar asked Mar 18 '15 15:03

Manikandan


1 Answers

You can do this:

<DataGridTextColumn>
    <DataGridTextColumn.ElementStyle>
        <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
            <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
        </Style>
    </DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
like image 186
Muds Avatar answered Sep 24 '22 03:09

Muds