RadGridView MaxHeight acts like Height

4 posts, 0 answers
  1. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 22 Sep 2009 Link to this post

    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.

     

     

     

     

     

  2. Kalin Milanov
    Admin
    Kalin Milanov avatar
    447 posts

    Posted 25 Sep 2009 Link to this post

    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.
  3. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 25 Sep 2009 Link to this post

    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!
  4. Kalin Milanov
    Admin
    Kalin Milanov avatar
    447 posts

    Posted 01 Oct 2009 Link to this post

    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.
Back to Top