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

Silverlight RadGridView : Memory consumption keeps on increasing while scrolling the grid when a custom row template is applied.

4 Answers 12 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gurpreet
Top achievements
Rank 1
Gurpreet asked on 23 May 2017, 04:00 AM

Hi,

I am using a custom control, inherited from RadGridView control.  Applied a custom GridViewRowTemplate on grid view row

After applying this template, memory consumption of grid keeps on increasing when we scroll the grid. 

Which part of the template is wrong and creating the problem ?

1.<Style x:Key="CommonGridViewRowStyle" TargetType="gridView:GridViewRow">
2.    <Setter Property="Template" Value="{StaticResource CommonGridViewRowTemplate}" />
3.</Style>

001.<ControlTemplate x:Key="CommonGridViewRowTemplate" TargetType="gridView:GridViewRow">
002.        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
003.            <VisualStateManager.VisualStateGroups>
004.                <VisualStateGroup x:Name="FocusStates">
005.                    <VisualState x:Name="Unfocused" />
006.                    <VisualState x:Name="Focused">
007.                        <Storyboard>
008.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NavigatorIndicator" Storyboard.TargetProperty="(UIElement.Visibility)">
009.                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" />
010.                            </ObjectAnimationUsingKeyFrames>
011.                        </Storyboard>
012.                    </VisualState>
013.                </VisualStateGroup>
014.                <VisualStateGroup x:Name="SelectionStates">
015.                    <VisualState x:Name="Unselected" />
016.                </VisualStateGroup>
017.                <VisualStateGroup x:Name="CommonStates">
018.                    <VisualState x:Name="Normal" />
019.                    <VisualState x:Name="MouseOver">
020.                        <Storyboard>
021.                            <ObjectAnimationUsingKeyFrames Duration="0"
022.                                                           Storyboard.TargetName="Background_Over"
023.                                                           Storyboard.TargetProperty="(UIElement.Visibility)">
024.                                <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
025.                            </ObjectAnimationUsingKeyFrames>
026.                        </Storyboard>
027.                    </VisualState>
028.                    <VisualState x:Name="Selected">
029.                        <Storyboard>
030.                            <ObjectAnimationUsingKeyFrames Duration="0"
031.                                                           Storyboard.TargetName="Background_Selected"
032.                                                           Storyboard.TargetProperty="(UIElement.Visibility)">
033.                                <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
034.                            </ObjectAnimationUsingKeyFrames>
035.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectionIndicator" Storyboard.TargetProperty="Visibility">
036.                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" />
037.                            </ObjectAnimationUsingKeyFrames>
038.                        </Storyboard>
039.                    </VisualState>
040.                </VisualStateGroup>
041.                <VisualStateGroup x:Name="ValueStates">
042.                    <VisualState x:Name="Valid" />
043.                    <VisualState x:Name="Invalid">
044.                        <Storyboard>
045.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Invalid" Storyboard.TargetProperty="(UIElement.Visibility)">
046.                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" />
047.                            </ObjectAnimationUsingKeyFrames>
048.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ErrorIndicator" Storyboard.TargetProperty="Visibility">
049.                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" />
050.                            </ObjectAnimationUsingKeyFrames>
051.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="EditIndicator" Storyboard.TargetProperty="Visibility">
052.                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed" />
053.                            </ObjectAnimationUsingKeyFrames>
054.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NavigatorIndicator" Storyboard.TargetProperty="Visibility">
055.                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed" />
056.                            </ObjectAnimationUsingKeyFrames>
057.                        </Storyboard>
058.                    </VisualState>
059.                </VisualStateGroup>
060.                <VisualStateGroup x:Name="EditStates">
061.                    <VisualState x:Name="ReadOnlyMode" />
062.                    <VisualState x:Name="EditMode">
063.                        <Storyboard>
064.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="EditIndicator" Storyboard.TargetProperty="Visibility">
065.                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" />
066.                            </ObjectAnimationUsingKeyFrames>
067.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NavigatorIndicator" Storyboard.TargetProperty="Visibility">
068.                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" />
069.                            </ObjectAnimationUsingKeyFrames>
070.                        </Storyboard>
071.                    </VisualState>
072.                </VisualStateGroup>
073.            </VisualStateManager.VisualStateGroups>
074. 
075.            <gridView:SelectiveScrollingGrid x:Name="grid">
076. 
077. 
078.                <gridView:SelectiveScrollingGrid.ColumnDefinitions>
079.                    <ColumnDefinition Width="Auto" />
080.                    <ColumnDefinition Width="Auto" />
081.                    <ColumnDefinition Width="Auto" />
082.                    <ColumnDefinition Width="*" />
083.                </gridView:SelectiveScrollingGrid.ColumnDefinitions>
084.                <gridView:SelectiveScrollingGrid.RowDefinitions>
085.                    <RowDefinition Height="*" />
086.                    <RowDefinition Height="Auto" />
087.                    <RowDefinition Height="Auto" />
088.                    <RowDefinition Height="Auto" />
089.                </gridView:SelectiveScrollingGrid.RowDefinitions>
090. 
091.                <Border x:Name="SelectionBackground"
092.                        Grid.Column="2"
093.                        Grid.ColumnSpan="2"
094.                        Margin="{TemplateBinding Margin}"
095.                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
096.                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
097.                        Background="{TemplateBinding Background}"
098.                        Padding="{TemplateBinding Padding}"
099.                        gridView:SelectiveScrollingGrid.SelectiveScrollingClip="True" />
100.                <Border x:Name="Background_Over"
101.                        Grid.Column="2"
102.                        Grid.ColumnSpan="2"
103.                        Margin="0"
104.                        BorderBrush="{StaticResource ItemOuterBorder_Over}"
105.                        BorderThickness="0"
106.                        CornerRadius="1"
107.                        Visibility="Collapsed"
108.                        gridView:SelectiveScrollingGrid.SelectiveScrollingClip="True">
109.                    <Border Background="{StaticResource ItemBackground_Over}"
110.                            BorderBrush="{StaticResource ItemInnerBorder_Over}"
111.                            BorderThickness="0" />
112.                </Border>
113.                <Border x:Name="Background_Selected"
114.                        Grid.Column="2"
115.                        Grid.ColumnSpan="2"
116.                        Margin="0"
117.                        BorderBrush="{StaticResource ItemOuterBorder_Selected}"
118.                        BorderThickness="0"
119.                        CornerRadius="1"
120.                        Visibility="Collapsed"
121.                        gridView:SelectiveScrollingGrid.SelectiveScrollingClip="True">
122.                    <Border Background="{StaticResource ItemBackground_Selected}"
123.                            BorderBrush="{StaticResource ItemInnerBorder_Selected}"
124.                            BorderThickness="0" />
125.                </Border>
126.                <Border x:Name="Background_Invalid"
127.                        Grid.Column="2"
128.                        Grid.ColumnSpan="2"
129.                        Margin="0"
130.                        BorderBrush="{StaticResource ItemOuterBorder_Invalid}"
131.                        BorderThickness="0"
132.                        CornerRadius="1"
133.                        Visibility="Collapsed"
134.                        gridView:SelectiveScrollingGrid.SelectiveScrollingClip="True">
135.                    <Border Background="{StaticResource ItemBackground_Invalid}"
136.                            BorderBrush="{StaticResource ItemInnerBorder_Invalid}"
137.                            BorderThickness="0" />
138.                </Border>
139.                <telerikGrid:GridViewToggleButton x:Name="PART_HierarchyExpandButton"
140.                                                  Grid.Column="2"
141.                                                  Width="25"
142.                                                  IsChecked="{Binding IsExpanded,
143.                                                                      Mode=TwoWay,
144.                                                                      RelativeSource={RelativeSource TemplatedParent}}"
145.                                                  IsHitTestVisible="{Binding IsExpandable,
146.                                                                             RelativeSource={RelativeSource TemplatedParent}}"
147.                                                  IsTabStop="{TemplateBinding IsTabStop}"
148.                                                  Opacity="{Binding IsExpandable,
149.                                                                    Converter={StaticResource BooleanToOpacityConverter},
150.                                                                    RelativeSource={RelativeSource TemplatedParent}}"
151.                                                  Visibility="{Binding HasHierarchy,
152.                                                                       Converter={StaticResource BooleanToVisibilityConverter},
153.                                                                       RelativeSource={RelativeSource TemplatedParent}}"
154.                                                  gridView:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
155.                                                  telerik:StyleManager.Theme="{StaticResource Theme}" />
156.                <Border Grid.Column="2"
157.                        Visibility="{Binding HasHierarchy,
158.                                             Converter={StaticResource BooleanToVisibilityConverter},
159.                                             RelativeSource={RelativeSource TemplatedParent}}"
160.                        gridView:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" />
161.                <gridView:DataCellsPresenter x:Name="PART_DataCellsPresenter"
162.                                             Grid.Column="3"
163.                                             telerik:StyleManager.Theme="{StaticResource Theme}" />
164.                <Border x:Name="PART_RowBorder"
165.                        Grid.RowSpan="4"
166.                        Grid.Column="1"
167.                        Grid.ColumnSpan="4"
168.                        VerticalAlignment="Bottom"
169.                        BorderBrush="{TemplateBinding HorizontalGridLinesBrush}"
170.                        BorderThickness="0 0 1 0"
171.                        gridView:SelectiveScrollingGrid.SelectiveScrollingClip="True" />
172. 
173.                <!--  IMPORTANT!!! Do not change this border thickness (the left border thickness)! It affects hierarchy child grid column alignments!  -->
174.                <Border Grid.Row="2"
175.                        Grid.Column="2"
176.                        Grid.ColumnSpan="2"
177.                        Background="{StaticResource GridView_HierarchyBackground}"
178.                        BorderBrush="{StaticResource ControlOuterBorder}"
179.                        BorderThickness="0,5"
180.                        Padding="0"
181.                        Visibility="{Binding IsExpanded,
182.                                             Converter={StaticResource BooleanToVisibilityConverter},
183.                                             RelativeSource={RelativeSource TemplatedParent}}"
184.                        gridView:SelectiveScrollingGrid.SelectiveScrollingClip="True">
185.                    <ContentPresenter x:Name="PART_HierarchyChildPresenter" gridView:SelectiveScrollingGrid.SelectiveScrollingClip="True" />
186.                </Border>
187. 
188.                <gridView:DetailsPresenter x:Name="PART_DetailsPresenter"
189.                                           Grid.Row="1"
190.                                           Grid.Column="2"
191.                                           Grid.ColumnSpan="2"
192.                                           DetailsProvider="{TemplateBinding DetailsProvider}"
193.                                           telerik:StyleManager.Theme="{StaticResource Theme}" />
194.                <gridView:IndentPresenter x:Name="PART_IndentPresenter"
195.                                          Grid.RowSpan="4"
196.                                          Grid.Column="1"
197.                                          IndentLevel="{TemplateBinding IndentLevel}"
198.                                          gridView:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
199.                                          telerik:StyleManager.Theme="{StaticResource Theme}" />
200.                <Border x:Name="PART_IndicatorPresenter"
201.                        Grid.RowSpan="3"
202.                        Grid.Column="0"
203.                        Width="25"
204.                        VerticalAlignment="Stretch"
205.                        BorderBrush="{StaticResource ControlOuterBorder}"
206.                        BorderThickness="0,0,1,1"
207.                        Visibility="{TemplateBinding RowIndicatorVisibility}"
208.                        gridView:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
209.                    <Border x:Name="NavigatorIndicatorBackground"
210.                            Background="{StaticResource GridView_RowIndicatorCellBackground}"
211.                            BorderThickness="0">
212.                        <Grid>
213.                            <!--  IMPORTANT! Don't remove following three lines. RadGridView will crash without this three parts.  -->
214.                            <Grid x:Name="NavigatorIndicator" Visibility="Collapsed" />
215.                            <Grid x:Name="EditIndicator" Visibility="Collapsed" />
216.                            <Grid x:Name="ErrorIndicator" Visibility="Collapsed" />
217. 
218.                            <Grid x:Name="SelectionIndicator"
219.                                  Width="11"
220.                                  Height="11"
221.                                  HorizontalAlignment="Center"
222.                                  VerticalAlignment="Center"
223.                                  Visibility="Collapsed">
224.                                <Path Width="8"
225.                                      Height="8"
226.                                      Margin="0"
227.                                      HorizontalAlignment="Center"
228.                                      VerticalAlignment="Center"
229.                                      Data="M0,0 L8,4 L0,8 L0,0"
230.                                      Fill="{StaticResource GridView_NavigatorIndicatorBackground}"
231.                                      Stretch="Fill" />
232.                            </Grid>
233.                        </Grid>
234.                    </Border>
235.                </Border>
236.            </gridView:SelectiveScrollingGrid>
237. 
238.        </Border>
239.    </ControlTemplate>

4 Answers, 1 is accepted

Sort by
0
Gurpreet
Top achievements
Rank 1
answered on 23 May 2017, 04:22 AM
 version of controls used is 2013.3.1204.1050
0
Yoan
Telerik team
answered on 25 May 2017, 12:13 PM
Hello,

I think that there is nothing suspicious in the template. However, since 2013.3.1204 version is very old, it is possible to have a memory problem. Can you test our latest official one - 2017.2.503 in order to verify that the problem is fixed and let me know about the result?

Regards,
Yoan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Gurpreet
Top achievements
Rank 1
answered on 25 May 2017, 01:02 PM

HI, 

Verified on 2017.2.503 version. There is no memory leak in this version. 

Can we have any fix on 2013.3.1204 version ?

Regards,

Gurpreet

0
Yoan
Telerik team
answered on 26 May 2017, 10:14 AM
Hi Gurpreet,

I am afraid that this is not possible. When we fix something it is released with our internal builds(every Monday) and then with our official version.

Regards,
Yoan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Gurpreet
Top achievements
Rank 1
Answers by
Gurpreet
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or