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

RadGridView MaxHeight acts like Height

3 Answers 171 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sintayehu
Top achievements
Rank 1
Sintayehu asked on 22 Sep 2009, 05:27 PM
I have to set a max height on a RadGridView to get the VerticalScroller Kickin.

And it does.

However if my grid is empty the GridView Max Height acts as If it was a height and shows the empty space.(If max height = 400 , and nodata gridheight is still 400) 

 

<TelerikGridView:RadGridView Margin="5" Grid.Row="3" x:Name="SomeGrid" ColumnsWidthMode="Fill" 

 

 AutoGenerateColumns="False" IsReadOnly="True" MinWidth="300" MaxHeight="100" > 

 

<TelerikGridView:RadGridView.Columns>

 

<TelerikGridView:GridViewDataColumn HeaderText="aaa" UniqueName="aaa" Width=".15*"/>

 

 

 

<TelerikGridView:GridViewDataColumn HeaderText="bbb" UniqueName="bbb" Width=".4*" />

 

 

 

<TelerikGridView:GridViewDataColumn HeaderText="ccc" UniqueName="ccc" Width=".45*"/>

 

 

 

</TelerikGridView:RadGridView.Columns>

 

 

 

</TelerikGridView:RadGridView>

I also tried adding min height = some very small number including 0. That didn't work either.

Thanx for the help.

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Kalin Milanov
Telerik team
answered on 25 Sep 2009, 08:33 AM
Hello luay,

The reason you are experiencing this is as follows:
The grid's vertical alignment by default is set to stretch which will always expand the grid to the space available by its parent container. By setting MaxHeight you limit the height of the grid but is the container's height is bigger than the MaxHeight the grid will expand.

What you need to do is set the VerticalAlignment property of the grid to top and then set a MaxHeight. Thus the grid will be less in height when it has no / less items and will show scroll bar when the items expand the height over the MaxHeight.

Browse the sample app and let me know if you need any further assistance.

Greetings,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sintayehu
Top achievements
Rank 1
answered on 25 Sep 2009, 03:40 PM
I tried what you suggested but it doesn't fix the issue.

If the ItemSource is empty, in a grid that has VerticalAlignment set to top and the maxheight to say 400.

The grid shows this big empty space.

I got rid of the itemsource in the example you sent me and tested it.

Here is the Change I made in the attachment.
//origional you sent out
        <telerikGridView:RadGridView VerticalAlignment="Top" MaxHeight="400" ItemsSource="{Binding Collection, Source={StaticResource SampleDataSource}}"/>

//My changes to simulate empty itemsource
<telerikGridView:RadGridView VerticalAlignment="Top" MaxHeight="400"/>

This shouldn't show me one big empty space.

Thanx!
0
Kalin Milanov
Telerik team
answered on 01 Oct 2009, 07:54 AM
Hi luay,

I have tried exactly what you described as a problem and you are right - the grid does not behave as it should when there is no ItemsSource set. I have also spent a good deal of time trying to work around it but alas to no avail. 

I have logged this bug in our backlog and we will be fixing this in the future.

Best wishes,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Sintayehu
Top achievements
Rank 1
Answers by
Kalin Milanov
Telerik team
Sintayehu
Top achievements
Rank 1
Share this question
or