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

Cell Stretching

10 Answers 15 Views
GridView
This is a migrated thread and some comments may be shown as answers.
WILLIAM
Top achievements
Rank 1
WILLIAM asked on 11 Jun 2014, 10:21 PM
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

10 Answers, 1 is accepted

Sort by
0
Boris
Telerik team
answered on 12 Jun 2014, 03:24 PM
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.
 
0
WILLIAM
Top achievements
Rank 1
answered on 12 Jun 2014, 05:31 PM
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..."
0
Boris
Telerik team
answered on 13 Jun 2014, 02:36 PM
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.
 
0
WILLIAM
Top achievements
Rank 1
answered on 13 Jun 2014, 04:25 PM
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.
0
WILLIAM
Top achievements
Rank 1
answered on 13 Jun 2014, 04:39 PM
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.
0
Ricky
Top achievements
Rank 1
answered on 13 Jun 2014, 05:24 PM
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>

0
Nick
Telerik team
answered on 16 Jun 2014, 11:20 AM
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.
 
0
WILLIAM
Top achievements
Rank 1
answered on 16 Jun 2014, 03:13 PM
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!
0
WILLIAM
Top achievements
Rank 1
answered on 16 Jun 2014, 07:58 PM
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.
0
WILLIAM
Top achievements
Rank 1
answered on 16 Jun 2014, 10:15 PM
Nevermind, I figured it out.  You have to set the cell style.

Thanks!!!
Tags
GridView
Asked by
WILLIAM
Top achievements
Rank 1
Answers by
Boris
Telerik team
WILLIAM
Top achievements
Rank 1
Ricky
Top achievements
Rank 1
Nick
Telerik team
Share this question
or