Performance issue on HierarchyChildTemplate

5 posts, 0 answers
  1. Ramesh
    Ramesh avatar
    4 posts
    Member since:
    Oct 2011

    Posted 01 Mar 2012 Link to this post

    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.


















  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 01 Mar 2012 Link to this post

    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 >>
  3. Ramesh
    Ramesh avatar
    4 posts
    Member since:
    Oct 2011

    Posted 01 Mar 2012 Link to this post

    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
  4. Ramesh
    Ramesh avatar
    4 posts
    Member since:
    Oct 2011

    Posted 01 Mar 2012 Link to this post

    Hi,

    will it help if i set the MaxHeight ?

    Regards

    Ramesh
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 01 Mar 2012 Link to this post

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