What role does RadGridViewAutomationPeer?
I have a RadGridView in my application, but when I change my DataContext to a new object containing a new List for the ItemsSource, the RadGridView is still holding all the old objects from the old List used by the ItemsSource in memory through this RadGridViewAutomationPeer. Not knowing what the AutomationPeer does, I'm at a bit of a loss as to how to get it to release those old objects. I wasn't able to find any useful information on this class. I've attached the memory retention chart from dotMemory showing my CurveSets being held.
Here's the xaml for the chart:
<
telerik:RadGridView
x:Name
=
"CurveList"
Grid.Row
=
"1"
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding Path=Wells}"
IsFilteringAllowed
=
"False"
ShowGroupPanel
=
"False"
CanUserSortColumns
=
"False"
SelectionMode
=
"Single"
IsSynchronizedWithCurrentItem
=
"True"
CurrentItem
=
"{Binding Path=DeclineConsolidator.CurrentCurve, Mode=TwoWay}"
GroupRenderMode
=
"Flat"
EnableRowVirtualization
=
"True"
>
<
telerik:RadGridView.Resources
>
<
consolidator:WellNameStyleSelector
x:Key
=
"NameStyleSelector"
>
<
consolidator:WellNameStyleSelector.CleanStyle
>
<
Style
TargetType
=
"{x:Type telerik:GridViewCell}"
>
<
Setter
Property
=
"FontStyle"
Value
=
"Normal"
/>
</
Style
>
</
consolidator:WellNameStyleSelector.CleanStyle
>
<
consolidator:WellNameStyleSelector.DirtyStyle
>
<
Style
TargetType
=
"{x:Type telerik:GridViewCell}"
>
<
Setter
Property
=
"FontStyle"
Value
=
"Italic"
/>
</
Style
>
</
consolidator:WellNameStyleSelector.DirtyStyle
>
</
consolidator:WellNameStyleSelector
>
</
telerik:RadGridView.Resources
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
""
Width
=
"25"
MaxWidth
=
"25"
MinWidth
=
"25"
IsReadOnly
=
"True"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
Image
Source
=
"{Binding Source={x:Static pcc:ImageSourceConstants.WarningIcon}}"
Visibility
=
"{Binding Path=IsValid, Converter={StaticResource InverseBoolToVisibilityConverter}}"
Tag
=
"{Binding Path=ErrorMessageAlert}"
Width
=
"15"
Height
=
"15"
Margin
=
"0,0,0,0"
>
<
i:Interaction.Behaviors
>
<
infrastructure:ImageGridValidationBehaviour
/>
</
i:Interaction.Behaviors
>
</
Image
>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"{x:Static prop:Resources.WellListColumnHeader}"
IsReadOnly
=
"True"
DataMemberBinding
=
"{Binding Path=DisplayName}"
Width
=
"*"
CellStyleSelector
=
"{StaticResource NameStyleSelector}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>