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

Ensure Radgridview takes up available space

5 Answers 333 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
peter
Top achievements
Rank 1
peter asked on 15 Jun 2012, 01:44 PM
Hi i have a radgridview, i want it to always take up the available space, regardless of how many rows appear, the problem i get at the moment is that there is still some space at the end. This is what my code looks like so far;

       <Grid x:Name="LayoutRoot">
           <Grid.RowDefinitions>
               <RowDefinition Height="80" />
               <RowDefinition Height="Auto"/>
           </Grid.RowDefinitions>
           <Grid Margin="0,100,0,3" Grid.Row="1">
                   <Grid.RowDefinitions>
                       <RowDefinition Height="30" />
                       <RowDefinition Height="1*"/>
                       <RowDefinition Height=".05*"/>
                   </Grid.RowDefinitions>
                   <Border Height="30">
                       <StackPanel Orientation="Horizontal">
                           <TextBlock Text="Member Details" Margin="5 0 20 5" Width="230" Foreground="Black" FontSize="14" Opacity="1" FontWeight="Black" FontStretch="ExtraCondensed"></TextBlock>
</StackPanel>
                   </Border>
                   <Telerik:RadGridView Name="_grid" Grid.Row="1"
                                               ItemsSource="{Binding PagedSource, ElementName=_radDataPager,Mode=TwoWay}" >                        <Telerik:RadGridView.Columns>
                           <Telerik:GridViewDataColumn Header="Member Name" TextWrapping="Wrap"  DataMemberBinding="{Binding Member_Name}" Width="2*" />                                                   
                       </Telerik:RadGridView.Columns>
                   </Telerik:RadGridView>
                   <Telerik:RadDataPager x:Name="_radDataPager" PageSize="10"  Grid.Row="2" DisplayMode="All" IsTotalItemCountFixed="True" Source="{Binding BindsDirectlyToSource=True, Mode=TwoWay, Path=STAMemberDetailsReportViewDTOs, Source={StaticResource vm}, TargetNullValue=''}" />
               </Grid>
       </Grid>

5 Answers, 1 is accepted

Sort by
0
peter
Top achievements
Rank 1
answered on 18 Jun 2012, 09:09 AM
Hi does anyone know how i can rectify this issue?
0
Dimitrina
Telerik team
answered on 18 Jun 2012, 09:22 AM
Hi,

 You could change your Grid RowDefinitions like so:

<Grid x:Name="LayoutRoot">
      <Grid.RowDefinitions>
          <RowDefinition Height="80" />
          <RowDefinition Height="*"/>
      </Grid.RowDefinitions>
      <Grid Margin="0,100,0,3" Grid.Row="1">
          <Grid.RowDefinitions>
              <RowDefinition Height="30" />
              <RowDefinition Height="1*"/>
              <RowDefinition Height=".05*"/>
          </Grid.RowDefinitions>
...

I have changed the second RowDefinition to be "*" rather then Auto.

I hope this is what you meant. Please let me know how this works for you.

Regards,
Didie
the Telerik team

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

0
peter
Top achievements
Rank 1
answered on 18 Jun 2012, 09:31 AM
Hi thanks for responding, unfortunately that didnt work, i want the radgrid to fill the remaining space, at the moment when the radgrid ends there is a massive white space. Hope i am making sense?
0
peter
Top achievements
Rank 1
answered on 18 Jun 2012, 10:21 AM
To make my question easier, how do i go about resizing the radgrid to ensure its height fills the screen for different screen resolutions. For instance 1280 * 1080, or 1920 * 1200?
0
Accepted
Dimitrina
Telerik team
answered on 18 Jun 2012, 04:02 PM
Hello,

 When you place the GridView in a RowDefinition with Height="*", then it will fill all the available space left. 
I have attached the sample project I prepared based on your code snippets.

You could check how the size of the GridView increases/decreases based on how you resize the containing window.

Kind regards,
Didie
the Telerik team

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

Tags
GridView
Asked by
peter
Top achievements
Rank 1
Answers by
peter
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or