This is a migrated thread and some comments may be shown as answers.

truncate display text in cell

4 Answers 149 Views
GridView
This is a migrated thread and some comments may be shown as answers.
paul orsillo
Top achievements
Rank 1
paul orsillo asked on 12 Jan 2011, 11:12 PM
I have a user notes gridview that in each row displays an entry date in one cell and note text in another cell. The note text can be long so I would like to display a long note truncating them with an ellipsis  if it exceeds a max length . This truncation is for display only the actual text is preserved in its entirety.

When the user clicks the cell (going into edit mode) the entire note can be viewed and  edited in place.

 I tried a  value converter but it converts the value regardless of whether the cell is in edit mode or not. 

Is there a way to do this without writing a custom column? That seems like overkill. 

Thank you,
 Paul Orsillo

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 13 Jan 2011, 08:04 AM
Hello,

 Have you tried TextTrimming column property? 

All the best,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
paul orsillo
Top achievements
Rank 1
answered on 13 Jan 2011, 02:50 PM
Hi Vlad, 

Yes I have tried TextTrimming and it is almost sufficient.  I can set a width. But I haven't found a way to set the height. My cell AcceptsReturn so the are line feeds in the string.   What I think I want is something like a cell width of 200  but a row height no higher than one or two lines.  

Thank you,
 Paul
0
Vanya Pavlova
Telerik team
answered on 17 Jan 2011, 04:16 PM
Hello paul orsillo,

 
Why not define the MaxHeight property for theTextBox that resides in GridViewDataColumn's CellEditTemplate as demonstrated below:

<telerik:GridViewDataColumn.CellEditTemplate>
    <DataTemplate>
        <TextBox AcceptsReturn="True" MaxHeight="50" Width="200" Text="{Binding Property2}"/>
    </DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>


Best wishes,
Vanya Pavlova
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
paul orsillo
Top achievements
Rank 1
answered on 17 Jan 2011, 05:44 PM
Yes. This did it.

Thank you,
 Paul 
Tags
GridView
Asked by
paul orsillo
Top achievements
Rank 1
Answers by
Vlad
Telerik team
paul orsillo
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or