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

Performance issue on HierarchyChildTemplate

4 Answers 132 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.
Ramesh
Top achievements
Rank 1
Ramesh asked on 01 Mar 2012, 08:31 AM
Hello,

I am trying to fix a performance issue when using HierarchyChildTemplate to create a hierarchical grid. Its having a huge performance issue when there are large amount of data / large strings in cells.
Here is the xaml code given .

<UserControl x:Class="GridBuildingBlock"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
             xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
             xmlns:telerikNs="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:Core="clr-namespace:System;assembly=mscorlib"
             Margin="0,0,0,5"
             xmlns:igWindows="http://infragistics.com/Windows"
             xmlns:buildingBlock="clr-namespace:BuildingBlocks"
             Width="Auto"
             Height="Auto"
             
             HorizontalAlignment="Stretch"
             VerticalAlignment="Stretch" SizeChanged="UserControl_SizeChanged">
    <UserControl.Resources>
        <telerik:Office_SilverTheme x:Key="Theme" />

        <DataTemplate x:Key="Child1" >
            <telerikGrid:RadGridView x:Name="rgvChid1" ShowGroupPanel="False" CanUserSortColumns="False" telerik:StyleManager.Theme="{StaticResource Theme}"
                                     IsFilteringAllowed="False" AutoGenerateColumns="False" CanUserDeleteRows="False"  
                                 CanUserInsertRows="False"  Loaded="rgvChid_Loaded"  Width="{Binding ElementName=rdgView,Path=ActualWidth}"     >
            </telerikGrid:RadGridView>
        </DataTemplate>
    </UserControl.Resources>

    <StackPanel Name="stkMain"                  Height="Auto">                  <Grid Margin="0,5,0,7"  >             <Grid.ColumnDefinitions>                 <ColumnDefinition Width="*"></ColumnDefinition>                 <ColumnDefinition MaxWidth="20" Width="{Binding Path=ActualWidth,ElementName=rgvMainSB}" ></ColumnDefinition>             </Grid.ColumnDefinitions>             <telerikGrid:RadGridView x:Name="rdgView" DataLoadMode="Synchronous" CanUserFreezeColumns="False"    telerik:StyleManager.Theme="{StaticResource Theme}"                            AutoGenerateColumns="False" ColumnWidth="*"   ShowGroupPanel="False"                           CanUserInsertRows="False"        CanUserSortColumns="True" Sorting="rdgView_Sorting" VirtualizingStackPanel.VirtualizationMode="Recycling"                           CanUserDeleteRows="False" ScrollViewer.HorizontalScrollBarVisibility="Hidden" IsSynchronizedWithCurrentItem="True">             </telerikGrid:RadGridView>             <ScrollBar  x:Name="rgvMainSB" Width="20"  Grid.Column="1" Orientation="Vertical" Visibility="Collapsed" ></ScrollBar>         </Grid>     </StackPanel> </UserControl>





And in the Main grid loaded event we are dynamically adding the columns to the main grid + setting the HierarchyChildTemplate property.
And in the child gridview loaded the child grids columns are being set.
  Private Sub rgvChid_Loaded(ByVal sender As System.ObjectByVal e As System.Windows.RoutedEventArgs)
            Dim rgv As RadGridView = DirectCast(sender, RadGridView)
            rgv.Width = rdgView.ActualWidth - 30
            If TypeOf rgv.DataContext Is GenericPresentationObject Then
                rgv.ItemsSource = DirectCast(rgv.DataContext, GenericPresentationObject).Properties(_LayoutIdentityCollection.Values(0))
            End If
            rgv.UpdateLayout()
            If rgv.Columns.Count = 0 Then
                Dim colConstruct As Reflection.ConstructorInfo
                For Each col In GetColumnCollectionForLayout(1)
                    Dim grdcolumn As GridViewColumn
                    colConstruct = col.GetType.GetConstructor(System.Type.EmptyTypes)
                    If colConstruct IsNot Nothing Then
                        grdcolumn = DirectCast(colConstruct.Invoke(Nothing), GridViewColumn)
                        grdcolumn.CopyPropertiesFrom(col)
                        rgv.Columns.Add(grdcolumn)
                    End If
                Next
                If UseChildGridRowSelection Then
                    AddHandler rgv.SelectionChanged, AddressOf rdgView_SelectionChanged
                End If
                CheckAndSetNewLayout(rgv, 2)
            End If
        End Sub

Please help me.


















4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 01 Mar 2012, 08:34 AM
Hi,

 You've missed to read our documentation and especially what will happen if you measure your grids with infinity height. 

Greetings,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ramesh
Top achievements
Rank 1
answered on 01 Mar 2012, 08:45 AM
Hi,

But i cannot mention the height as the child grid data is loaded dynamically and the child grids row height can vary.

Regards

Ramesh
0
Ramesh
Top achievements
Rank 1
answered on 01 Mar 2012, 03:03 PM
Hi,

will it help if i set the MaxHeight ?

Regards

Ramesh
0
Vlad
Telerik team
answered on 01 Mar 2012, 03:31 PM
Hi,

 Indeed this can help. 

Regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
Ramesh
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Ramesh
Top achievements
Rank 1
Share this question
or