truncate display text in cell

5 posts, 0 answers
  1. paul orsillo
    paul orsillo avatar
    31 posts
    Member since:
    Jan 2010

    Posted 12 Jan 2011 Link to this post

    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
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 13 Jan 2011 Link to this post

    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>>
  3. paul orsillo
    paul orsillo avatar
    31 posts
    Member since:
    Jan 2010

    Posted 13 Jan 2011 Link to this post

    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
  4. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 17 Jan 2011 Link to this post

    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>>
  5. paul orsillo
    paul orsillo avatar
    31 posts
    Member since:
    Jan 2010

    Posted 17 Jan 2011 Link to this post

    Yes. This did it.

    Thank you,
     Paul 
Back to Top