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

Virtualizing GridView with Auto height

5 Answers 341 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Maxim
Top achievements
Rank 1
Maxim asked on 27 Jul 2012, 11:41 AM
I have a GridView that displays huge amounts of data. Moreover, columns are generated dynamically depending on the data and columns use custom DataTemplates. That said, GridView really takes some time to draw itself and virtualization feature is crucial for decent performace. However this feature is set to OFF once GridView height is not fixed. Obviously I want my GridView to occupy all available space and change its size when app window is resized. I.e. I want the effect equal to GridView.Height = Auto.

How can I achieve this - that GridView adjusts its size to available free space and still uses virtualization? 

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 27 Jul 2012, 12:01 PM
Hi,

 You can simply put RadGridView in a Grid panel with Row.Height = *. In this case RadGridView will occupy the whole available space and will provide scrollbar to scroll the items virtually. 

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Maxim
Top achievements
Rank 1
answered on 27 Jul 2012, 03:03 PM
Thank you for the fast reply! But unfortunatelly this does not seem to be the case, or I am still missing something. I tried the following:

<Grid>
      <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
          <RowDefinition Height="*" />
      </Grid.RowDefinitions>
 
      <telerik:RadBusyIndicator Grid.Column="0" Grid.Row="0" IsBusy="{Binding IsBusy, Mode=TwoWay}">
          <telerik:RadGridView x:Name="TabularPropertyView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                  AutoGenerateColumns="False"
                  SelectionMode="Extended"
                  RowIndicatorVisibility="Collapsed"
                  SelectionUnit="Cell"
                  RowHeight="26"
                  EnableRowVirtualization="True"
                  EnableColumnVirtualization="True"
                  ScrollMode="Deferred" Sorting="TabularPropertyView_Sorting"
                  ShowGroupPanel="False">
              <telerik:RadGridView.Columns>
                  <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Owner.ResultTimestamp}" Header="{StaticResource FeatureEditor_Presentations_Observations_ResultTimestamp}" IsCustomSortingEnabled="True" />
                  <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Owner.SamplingTimestamp}" Header="{StaticResource FeatureEditor_Presentations_Observations_SamplingTimestamp}" IsCustomSortingEnabled="True" />
              </telerik:RadGridView.Columns>
          </telerik:RadGridView>
      </telerik:RadBusyIndicator>

More columns are added programmatically, average total number is about 10. This mark up takes about 15 seconds to render with 500 rows with custom DataTemplates. If I set Height on GridView, it takes only 1 second.

Just for info: this GridView is in a user control, that is added to a parent user control through template selector like this (i.e. GridView goes to the ContentControl):
<UserControl >
 
 <ContentControl Content="{Binding}" ContentTemplateSelector="..." />
           
</UserControl>
0
Vlad
Telerik team
answered on 30 Jul 2012, 05:39 AM
Hello,

Can you replace RadGridView temporary with regular ListBox or DataGrid and let us know what is the result in your case?

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Maxim
Top achievements
Rank 1
answered on 30 Jul 2012, 07:14 AM
Hello Vlad,

I replaced your Grid with normal DataGrid:

<telerik:RadBusyIndicator IsBusy="{Binding IsBusy, Mode=TwoWay}">
    <DataGrid x:Name="TabularPropertyView"   Height="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"                 >
         
            <DataGridTextColumn  Binding="{Binding Path=Owner.ResultTimestamp}" Header="{StaticResource FeatureEditor_Presentations_Observations_ResultTimestamp}" />
            <DataGridTextColumn  Binding="{Binding Path=Owner.SamplingTimestamp}" Header="{StaticResource FeatureEditor_Presentations_Observations_SamplingTimestamp}" />
         
    </DataGrid>
</telerik:RadBusyIndicator>

Then I add DataGridTemplatedColumns in code behind, based on bound object.

So the standard Grid performace in my case is about 40 second without placing it into a Row, and only 11 seconds when placing it into a row with Height="*". Telerik GridView in a Row performs however worse, displaying the same info in about 30 sec.

Maxim
0
Vlad
Telerik team
answered on 30 Jul 2012, 07:17 AM
Hi,

 What I was asking actually was if the standard components like ListBox and DataGrid are measured with infinity height similar to RadGridView in your case. Do you have vertical scrollbars for these components? Can you scroll vertically?

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Maxim
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Maxim
Top achievements
Rank 1
Share this question
or