Cell Stretching

11 posts, 0 answers
  1. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 11 Jun 2014 Link to this post

    Hi Telerik Team,

    I have a column/cell that stretches vertically to show the entire contents of the cell.  It's a DataColumn.  What property do I set so that the row height doesn't change?

    Thanks
  2. Boris
    Admin
    Boris avatar
    276 posts

    Posted 12 Jun 2014 Link to this post

    Hello William,

    A possible way to resolve this issue is to set the TextTrimming property of the GridViewDataColumn to "WordEllipsis" or "CharacterEllipsis". Please keep in mind that if you have set the TextWrapping property to the GridViewDataColumn as well the extra text will not be trimmed. 

    Please let us know if this helps or not.

    Regards,
    Boris Penev
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. DevCraft banner
  4. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 12 Jun 2014 in reply to Boris Link to this post

    Unfortunately this did not work.

    I don't see a "CharacterEllipsis" option for TextTrimming.
    Setting TextTrimming to "WordEllipsis" only works horizontally.

    Again,
    The issue is I have a cell that grows in height.  I don't want that.

    i.e.  If the entire text of this comment were in a cell, I should only see "Unfortunately, this did not work..."
  5. Boris
    Admin
    Boris avatar
    276 posts

    Posted 13 Jun 2014 Link to this post

    Hello William, 

    You are correct about the "CharacterEllipsisoption for TextTrimming property. That was a mistake on my part. 
    As for the issue, I attached a sample project that demonstrates the suggestion from my previous reply. 

    Please examine the project and if you still have issues could you please send us some code snippets of your RadGridView definition or modify the example to match your case?

    Regards,
    Boris Penev
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 13 Jun 2014 in reply to Boris Link to this post

    I wasn't able to get your project to run, but based on the data you have for the clubs, you're still missing the problem.  Look at the Telerik grid demo for Row Resizing.  You will see some addresses are multiple lines and the row resizes to show the entire value.  I don't want the row to resize.  Another way would be to run a grid you have.  Copy this post and paste it in a cell.  

    I want the cell to contain the all of the data, but I don't want it to grow either horizontally or vertically. i.e. most of it will not be visible.
  7. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 13 Jun 2014 in reply to WILLIAM Link to this post

    In the xaml of the demo I mentioned above, there is setting "CanUserResizeRows".  In the demo, it's set to true, but when I set it false, the row still expands.
  8. Ricky
    Ricky avatar
    21 posts
    Member since:
    Feb 2011

    Posted 13 Jun 2014 in reply to WILLIAM Link to this post

    You could something like this:

                          <telerik:GridViewColumn Width="90">
                                <telerik:GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Address}" MaxHeight="25" />
                                    </DataTemplate>
                                </telerik:GridViewColumn.CellTemplate>
                            </telerik:GridViewColumn>

  9. Nick
    Admin
    Nick avatar
    593 posts

    Posted 16 Jun 2014 Link to this post

    Hi William,

    You can set a style to the GridViewRow, that will specify the MaxHeight to the value you find suitable. This will prevent the row form resizing further that the set value. 

    Hope this helps. 

    Regards,
    Nik
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  10. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 16 Jun 2014 in reply to Nick Link to this post

    I was able to set the style to keep the row height from expanding by setting the RowStyle as you suggested.  That works!  Thank you.

    However it introduced another problem that I've not been able to figure out.  I have two GridViewImageColumns and the images by default center both vertically and horizontally.  This remains true unless it's a row the would have otherwise increased in height.  I have tried setting the CellStyle for the column with Vertical and Horizontal Content Alignment as Center, along with GridViewImageColumn.ImageStretch = None and Uniform.  None of these have any effect.

    How do I keep the image centered in the cell?  See the attached image.

    Thanks again for your help!
  11. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 16 Jun 2014 in reply to WILLIAM Link to this post

    I have determined what is causing the issue in the image attachment above.  It seems that the row size is actually expanded to the height of the of the most data in the cell, which is "centered" vertically; but the row is only showing the portion of the row that falls within the specified height.  Everything else is hidden.  Setting both the vertical and vertical content alignments to "Top" do not bring the values to the top of the cell even thought the properties suggest they do.

    See the attached images:
    Image 1:  On row 4, you can't see the values for columns 1, 2, 4 and the columns with names.
    Image 2:  Shows the values centered vertically, which is why you don't see them in Image 1.
    Image 3:  Shows an approximation of what I want it to look like.  It isn't perfect because I had to copy and paste from a screen shot.  Refer to row 3 for the exact look.

    I seem to spend a great deal of time trying to figure out how to make your controls works; instead working on improving our application for our users.  To me, this should not be this big of deal to get to work; and I have spent hours on trying to figure out how to get this to display with no luck.
  12. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 16 Jun 2014 in reply to WILLIAM Link to this post

    Nevermind, I figured it out.  You have to set the cell style.

    Thanks!!!
Back to Top
DevCraft banner