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

"Fix" the height of a paged RadGridView

2 Answers 54 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Wayne
Top achievements
Rank 1
Wayne asked on 20 Jun 2012, 08:59 PM
Maybe this is obvious but I can't seem to figure it out.
I have a RadGridView that's displaying paged data (with a RadDataPager).
Let's say the page size is N.
When there are less than N items in the data source, the grid sizes itself exactly to the number of rows.
When there are exactly or more than N items in the data source, the grid sizes itself exactly to N rows (and it will never be any bigger, of course).
Is it possible to "lock" the grid's desired height to the PageSize (so that it doesn't change size regardless of the number of items being displayed, and it's always exactly big enough to show N items, with empty space only if the number of items is less than N).
The grid's containing element will size itself dynamically according to the grid's preferred size. 
I don't want to hard-code the Height, for obvious reasons.

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 21 Jun 2012, 05:31 AM
Hello,

 This can happen only if the grid is measured with infinity height (inside StackPanel) - still it will be better to avoid such layout since if you have large collection of items displayed at once you may get huge performance problems. When a UI virtual component like RadGridView, DataGrid, ListBox, ListView, etc. is measured with infinity the UI virtualization will be off - the component will try to create all containers for all data items at once. 

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Wayne
Top achievements
Rank 1
answered on 21 Jun 2012, 01:06 PM
But, since I'm setting PageSize=N on the RadDataPager, won't the maximum height of the grid be limited to just that height which can show N items?

I'm confused.
Tags
GridView
Asked by
Wayne
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Wayne
Top achievements
Rank 1
Share this question
or