views:

58

answers:

1

Hello,

I have a column with long user comments. I load it using following code...

<my:DataGridTextColumn Header="Message"
                       Binding="{Binding UserMessage, Mode=OneWay}" 
                       CanUserSort="True">
    <my:DataGridTextColumn.ElementStyle>
        <Style TargetType="{x:Type TextBlock}"
               BasedOn="{StaticResource {x:Type TextBlock}}">
               <Setter Property="TextWrapping"
                       Value="NoWrap" />
               <Setter Property="TextTrimming"
                       Value="CharacterEllipsis"/>                                    
               <Setter Property="ToolTip"
                       Value="{Binding Path=UserMessage, Mode=OneWay}"/>
        </Style>
    </my:DataGridTextColumn.ElementStyle>
</my:DataGridTextColumn>

But the ellipsis wont work. The column continues to display long text of data. Also when I set the width of the textblock explicitly to some value then the ellipsis work fine but when I resize my column it wont show any more text in it.

Isnt there a starighforward way to do this?

Thx Vinit Sankhe.

A: 

Have a look at this article. It think it's the solution you're looking for:

Gustavo Cavalcanti