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

RadGridView starts infinite loop when adding items.

7 Answers 518 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 19 Sep 2013, 11:15 PM
Specifications:

Telerik libraries - RadControls for WPF Q2 3013 SP1
My Project: WPF desktop application in.Net 4.0 C#.

The problem:

I'm adding rows to the RagGridView through an ItemsSource binding to an observable collection.  Whenever an item is added to the collection, the RagGridView control reloads all previously added rows along with the new row.  It also re-instantiates user controls from the exsting rows.  For example, If I have 20 rows, and one gets added from the collection, the entire 20 rows are reloaded before the new one gets loaded. This makes the GUI get slower and slower as rows are added.

What's worse: When items are added that will be displayed out of the scrolling view, the RagGridView reloads all the old rows and then it eventually (after about 15 items are added that are not visible) goes into an infinite loop reloading all the rows that are not visible.  This locks up the GUI and fills up system memory since it re-instantiates user controls.  This infinite loop happens in my situation after about 45 to 50 rows total are in the grid control.

Here's the XAML definition of the control:

<telerik:RadGridView
    Name="VirtualDomainConfigurationsGrid"
    Grid.Row="0"
    ItemsSource="{Binding VirtualDomains}"
    Foreground="White"
    VerticalAlignment="Stretch"
    HorizontalAlignment="Stretch"
    AutoGenerateColumns="False"
    RowIndicatorVisibility="Collapsed"
    RowDetailsVisibilityMode="Collapsed"
    ShowGroupPanel="False"
    IsFilteringAllowed="False"
    CanUserFreezeColumns="False"
    CanUserReorderColumns="False"
    FrozenColumnsSplitterVisibility="Collapsed"
    CanUserSortColumns="True"
    SelectionUnit="FullRow"
    SelectionMode="Extended"
    BorderBrush="Transparent"
    Background="Transparent"
    SelectionChanged="VirtualDomainConfigurationsGrid_SelectionChanged"
    VirtualizingStackPanel.IsVirtualizing="True"
    VirtualizingStackPanel.VirtualizationMode="Standard"
    IsReadOnly="True"
    PreviewMouseRightButtonDown="VirtualDomainConfigurationsGrid_PreviewMouseRightButtonDown"
    PreviewMouseLeftButtonDown="VirtualDomainConfigurationsGrid_PreviewMouseLeftButtonDown"
    GridLinesVisibility="None"
    AlternationCount="2"
    AlternateRowBackground="{StaticResource DarkerBackgroundColor}"
    RowLoaded="VirtualDomainConfigurationsGrid_RowLoaded"
    >
    <telerik:RadGridView.InputBindings>
        <KeyBinding Command="{Binding Source={x:Static t:GenesisCommands.DeleteVantageVirtualDomain}}" Key="Delete" Gesture="Delete" />
    </telerik:RadGridView.InputBindings>
    <telerik:RadGridView.Resources>
        <Style TargetType="telerik:GridViewRow">
            <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}"/>
        </Style>
 
        <converters:StringToStyleConverter x:Key="stringToStyleConverter" />
    </telerik:RadGridView.Resources>
 
    <telerik:RadGridView.ContextMenu>
        <ContextMenu Name="VirtaulClusteContextMenu">
            <MenuItem
                Name="NewVirtualDomainContextMenuItem"
                Header="New Virtual Domain"
                Command="{Binding Source={x:Static t:GenesisCommands.CreateNewVantageVirtualDomain}}"
                IsEnabled="{Binding Source={x:Static dm:CloudServiceProviderAccountsDataModel.Instance}, Path=HasDefaultAccount}"
                />
            <MenuItem
                Name="DeleteVirtualDomainContextMenuItem"
                Header="Delete Virtual Domain"
                Command="{Binding Source={x:Static t:GenesisCommands.DeleteVantageVirtualDomain}}"
               />
            <MenuItem
                Name="StartVirtualDomainContextMenuItem"
                Header="Start Virtual Domain"
                Command="{Binding Source={x:Static t:GenesisCommands.StartVantageVirtualDomain}}"
               />
            <MenuItem
                Name="PauseVirtualDomainContextMenuItem"
                Header="Pause Virtual Domain"
                Command="{Binding Source={x:Static t:GenesisCommands.PauseVantageVirtualDomain}}"
               />
            <MenuItem
                Name="StopVirtualDomainContextMenuItem"
                Header="Stop Virtual Domain"
                Command="{Binding Source={x:Static t:GenesisCommands.StopVantageVirtualDomain}}"
               />
        </ContextMenu>
    </telerik:RadGridView.ContextMenu>
     
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn
            Name="VirtualClusterNameGridViewDataColumn"
            Header="Name"
            Width="150"
            MinWidth="100"
            IsSortable="True"
            SortingState="None"
           >
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <StackPanel
                        Orientation="Horizontal"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        ToolTip="{Binding CurrentName}"                                     
                        >
                        <Button
                            Margin="1,0,2,0"
                            Visibility="{Binding ProgressVisibilityInverted}">
                            <Button.Style>
                                <MultiBinding Converter="{StaticResource stringToStyleConverter}">
                                    <MultiBinding.Bindings>
                                        <Binding RelativeSource="{RelativeSource Self}"/>
                                        <Binding Path="StatusColorStyle"/>
                                    </MultiBinding.Bindings>
                                </MultiBinding>
                            </Button.Style>
                        </Button>
                        <Viewbox
                            Width="13" Height="13"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Visibility="{Binding ProgressVisibility}">
                            <usercontrols:CircularProgressBar />
                        </Viewbox>
                        <Label Foreground="White" Content="{Binding CurrentName}" Margin="4,0,0,0"/>
                    </StackPanel>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn
            Name="VirtualClusterStateGridViewDataColumn"
            Header="State"
            Width="150"
            MinWidth="100"
            IsSortable="True"
            SortingState="None"
            >
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <Label
                        Content="{Binding DataModel.State}"
                        ToolTip="{Binding DataModel.State}">
                    </Label>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn
            Name="VirtualClusterMessageGridViewDataColumn"
            Header="Details"
            Width="330"
            MinWidth="200"
            IsSortable="True"
            SortingState="None"
            >
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <StackPanel
                        Orientation="Horizontal"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        ToolTip="{Binding DataModel.StatusMessage}"
                        >
                        <Label
                            Foreground="White"
                            Content="{Binding CurrentCommandName}"
                            Margin="0,0,0,0"
                            Visibility="{Binding ProgressVisibility}"/>
                        <Label
                            Foreground="White"
                            Content=" ("
                            Margin="2,0,0,0"
                            Visibility="{Binding ProgressVisibility}"/>                                   
                        <Label
                            Foreground="White"
                            Content="{Binding DataModel.TransitionProgressPercentage, Converter={StaticResource percentageConverter}}"
                            Margin="2,0,0,0"
                            Visibility="{Binding ProgressVisibility}"
                            />
                        <Label
                            Foreground="White"
                            Content="):"
                            Margin="2,0,5,0"
                            Visibility="{Binding ProgressVisibility}"/>
                        <Label
                            Foreground="White"
                            Content="{Binding DataModel.StatusMessage}"
                            />
                    </StackPanel>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>
         
    </telerik:RadGridView.Columns>           
</telerik:RadGridView>

Here is the stack trace from my RowLoaded callback method while the RadGridControl is caught in the infinite loop:

>   VantageVirtualDomainManagement.exe!Telestream.Genesis.Client.Gui.MainWindow.VirtualDomainConfigurationsGrid_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e) Line 270   C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.OnRowLoaded(Telerik.Windows.Controls.GridView.RowLoadedEventArgs e) Line 478    C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.RaiseRowLoaded(Telerik.Windows.Controls.GridView.GridViewRowItem row) Line 7971 C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewRowItem.MeasureOverride(System.Windows.Size availableSize) Line 239 C#
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.NestedLayoutStrategy.MeasureChild(System.Windows.UIElement child, System.Windows.Size layoutSlotSize, int i) Line 1582    C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.NestedLayoutStrategy.MeasureOverride(System.Windows.Size constraint) Line 213 + 0x44 bytes    C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(System.Windows.Size availableSize) Line 342 + 0x47 bytes  C#
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement element, System.Windows.Size constraint) + 0x6a bytes  
    PresentationFramework.dll!System.Windows.Controls.ScrollContentPresenter.MeasureOverride(System.Windows.Size constraint) + 0x19e bytes 
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCell(int cell, bool forceInfinityV) + 0x1a8 bytes
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCellsGroup(int cellsHead, System.Windows.Size referenceSize, bool ignoreDesiredSizeU, bool forceInfinityV, out bool hasDesiredSizeUChanged) + 0x169 bytes
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCellsGroup(int cellsHead, System.Windows.Size referenceSize, bool ignoreDesiredSizeU, bool forceInfinityV) + 0x3a bytes  
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size constraint) + 0x440 bytes   
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Controls.ScrollViewer.MeasureOverride(System.Windows.Size constraint) + 0x37c bytes   
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewScrollViewer.MeasureOverride(System.Windows.Size availableSize) Line 199 + 0x2d bytes   C#
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCell(int cell, bool forceInfinityV) + 0x1a8 bytes
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCellsGroup(int cellsHead, System.Windows.Size referenceSize, bool ignoreDesiredSizeU, bool forceInfinityV, out bool hasDesiredSizeUChanged) + 0x169 bytes
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCellsGroup(int cellsHead, System.Windows.Size referenceSize, bool ignoreDesiredSizeU, bool forceInfinityV) + 0x3a bytes  
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size constraint) + 0x440 bytes   
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Controls.Border.MeasureOverride(System.Windows.Size constraint) + 0x2f3 bytes 
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Controls.Control.MeasureOverride(System.Windows.Size constraint) + 0x6a bytes 
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.MeasureOverride(System.Windows.Size availableSize) Line 6677 + 0x3c bytes   C#
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCell(int cell, bool forceInfinityV) + 0x1a8 bytes
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCellsGroup(int cellsHead, System.Windows.Size referenceSize, bool ignoreDesiredSizeU, bool forceInfinityV, out bool hasDesiredSizeUChanged) + 0x169 bytes
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCellsGroup(int cellsHead, System.Windows.Size referenceSize, bool ignoreDesiredSizeU, bool forceInfinityV) + 0x3a bytes  
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size constraint) + 0x440 bytes   
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCell(int cell, bool forceInfinityV) + 0x1a8 bytes
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCellsGroup(int cellsHead, System.Windows.Size referenceSize, bool ignoreDesiredSizeU, bool forceInfinityV, out bool hasDesiredSizeUChanged) + 0x169 bytes
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCellsGroup(int cellsHead, System.Windows.Size referenceSize, bool ignoreDesiredSizeU, bool forceInfinityV) + 0x3a bytes  
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size constraint) + 0x6a9 bytes   
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement element, System.Windows.Size constraint) + 0x6a bytes  
    PresentationFramework.dll!System.Windows.Controls.ContentPresenter.MeasureOverride(System.Windows.Size constraint) + 0x26 bytes
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Documents.AdornerDecorator.MeasureOverride(System.Windows.Size constraint) + 0x98 bytes   
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Controls.Border.MeasureOverride(System.Windows.Size constraint) + 0x2f3 bytes 
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Window.MeasureOverrideHelper(System.Windows.Size constraint) + 0x1c0 bytes
    PresentationFramework.dll!System.Windows.Window.MeasureOverride(System.Windows.Size availableSize) + 0x171 bytes   
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x760 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayout() + 0x569 bytes  
    PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayoutCallback(object arg) + 0x22 bytes 
    PresentationCore.dll!System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() + 0x96 bytes  
    PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandlerCore(object resizedCompositionTarget) + 0xdf bytes  
    PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandler(object resizedCompositionTarget) + 0x2f bytes  
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x5e bytes
    WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x47 bytes   
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() + 0x281 bytes
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x285 bytes
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x9 bytes  
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x57 bytes   
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() + 0x71 bytes 
    WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() + 0x2a1 bytes   
    WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0xb3 bytes
    WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x14a bytes  
    WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x80 bytes   
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x5e bytes
    WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x47 bytes   
    WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) + 0x2bc bytes
    WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) + 0x140 bytes   
    [Native to Managed Transition] 
    [Managed to Native Transition] 
    WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) + 0x112 bytes
    PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x17a bytes   
    PresentationFramework.dll!System.Windows.Application.Run() + 0x67 bytes
    VantageVirtualDomainManagement.exe!Telestream.Genesis.Client.Gui.App.Main() + 0x77 bytes    C#
    [Native to Managed Transition] 
    [Managed to Native Transition] 
    Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x5a bytes 
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x285 bytes
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x9 bytes  
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x57 bytes   
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x51 bytes  
    [Native to Managed Transition] 


And here's the stack trace when the control is instantiating my CircularProgressBar user control in the infinite loop:


>   VantageVirtualDomainManagement.exe!Telestream.Genesis.Client.Gui.UserControls.CircularProgressBar.CircularProgressBar() Line 36 C#
    mscorlib.dll!System.Activator.CreateInstance(System.Type type, bool nonPublic) + 0x7f bytes
    mscorlib.dll!System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, object[] args, System.Globalization.CultureInfo culture, object[] activationAttributes, ref System.Threading.StackCrawlMark stackMark) + 0x5ff bytes   
    mscorlib.dll!System.Activator.CreateInstance(System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, object[] args, System.Globalization.CultureInfo culture, object[] activationAttributes) + 0xc8 bytes   
    mscorlib.dll!System.Activator.CreateInstance(System.Type type, object[] args) + 0x26 bytes 
    System.Xaml.dll!System.Xaml.Schema.SafeReflectionInvoker.CreateInstanceCritical(System.Type type, object[] arguments) + 0x1d bytes 
    System.Xaml.dll!System.Xaml.Schema.XamlTypeInvoker.CreateInstance(object[] arguments) + 0x97 bytes 
    System.Xaml.dll!MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(System.Xaml.XamlType xamlType, object[] args) + 0x85 bytes
    System.Xaml.dll!MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.CreateInstance(System.Xaml.XamlType xamlType, object[] args) + 0x87 bytes 
    System.Xaml.dll!System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(MS.Internal.Xaml.Context.ObjectWriterContext ctx) + 0xbc bytes 
    System.Xaml.dll!System.Xaml.XamlObjectWriter.WriteEndObject() + 0x44d bytes
    PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadTemplateXaml(System.Xaml.XamlReader templateReader, System.Xaml.XamlObjectWriter currentWriter) + 0x56 bytes
    PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadTemplateXaml(System.Xaml.XamlObjectWriter objectWriter) + 0x67 bytes
    PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(System.Windows.DependencyObject container, System.Windows.Markup.IComponentConnector componentConnector, System.Windows.Markup.IStyleConnector styleConnector, System.Collections.Generic.List<System.Windows.DependencyObject> affectedChildren, System.Windows.UncommonField<System.Collections.Hashtable> templatedNonFeChildrenField) + 0x363 bytes
    PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadContent(System.Windows.DependencyObject container, System.Collections.Generic.List<System.Windows.DependencyObject> affectedChildren) + 0xaf bytes  
    PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadContent() + 0x52 bytes  
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridViewColumn.GenerateElementWithHashCode(System.Windows.DataTemplate template) Line 362 + 0x12 bytes   C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridViewColumn.GenerateElementFromCellTemplate(Telerik.Windows.Controls.GridView.GridViewCell cell, System.Windows.DataTemplate template, out System.Windows.FrameworkElement element) Line 335 + 0xd bytes  C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridViewColumn.CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem) Line 321 + 0x19 bytes C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridViewBoundColumnBase.CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem) Line 117 + 0x1d bytes    C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewCell.CreateCellElement(Telerik.Windows.Controls.GridViewColumn column, object dataItem) Line 563 + 0x2b bytes   C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewCell.BuildVisualTree() Line 557 C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewCell.SetCellElement() Line 520  C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewRow.PrepareCell(Telerik.Windows.Controls.GridView.GridViewCellBase cellBase, Telerik.Windows.Controls.GridViewColumn column) Line 921   C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewCellsPanel.PrepareCell(Telerik.Windows.Controls.GridView.GridViewCellBase cell, Telerik.Windows.Controls.GridViewColumn column) Line 404    C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewCellsPanel.GetVirtualizedCell(Telerik.Windows.Controls.GridViewColumn column, bool createIfNull) Line 365   C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewCellsPanel.RealizeAndMeasureCells(int startIndex, int predictedLastIndex, System.Func<int,int> calculateNextIndex) Line 300 + 0x15 bytes    C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewCellsPanel.UpdateVirtualizedCells() Line 235    C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(System.Windows.Size availableSize) Line 289 + 0xd bytes  C#
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement element, System.Windows.Size constraint) + 0x6a bytes  
    PresentationFramework.dll!System.Windows.Controls.ItemsPresenter.MeasureOverride(System.Windows.Size constraint) + 0x26 bytes  
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size constraint) + 0x11e bytes   
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationFramework.dll!System.Windows.Controls.Control.MeasureOverride(System.Windows.Size constraint) + 0x6a bytes 
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x313 bytes 
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x521 bytes 
    PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayout() + 0x569 bytes  
    PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayoutCallback(object arg) + 0x22 bytes 
    PresentationCore.dll!System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() + 0x96 bytes  
    PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandlerCore(object resizedCompositionTarget) + 0xdf bytes  
    PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandler(object resizedCompositionTarget) + 0x2f bytes  
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x5e bytes
    WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x47 bytes   
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() + 0x281 bytes
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x285 bytes
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x9 bytes  
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x57 bytes   
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() + 0x71 bytes 
    WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() + 0x2a1 bytes   
    WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0xb3 bytes
    WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x14a bytes  
    WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x80 bytes   
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x5e bytes
    WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x47 bytes   
    WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) + 0x2bc bytes
    WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) + 0x140 bytes   
    [Native to Managed Transition] 
    [Managed to Native Transition] 
    WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) + 0x112 bytes
    PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x17a bytes   
    PresentationFramework.dll!System.Windows.Application.Run() + 0x67 bytes
    VantageVirtualDomainManagement.exe!Telestream.Genesis.Client.Gui.App.Main() + 0x77 bytes    C#
    [Native to Managed Transition] 
    [Managed to Native Transition] 
    Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x5a bytes 
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x285 bytes
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x9 bytes  
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x57 bytes   
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x51 bytes  
    [Native to Managed Transition] 

I have tried turning data virturalization on and off with no change the results.  I have used the RadGridConrol with much success in the past, but I'm stumped here.  I hope I'm just missing something stupid.

Any suggestions?  Thanks.

7 Answers, 1 is accepted

Sort by
0
Don
Top achievements
Rank 1
answered on 23 Sep 2013, 11:46 PM
UPDATE: I re-factored a few things which made the infinite looping go away by using the RowLoaded handler to update values at a friendler time.  However, I am still having the problem where all the existing rows are being re-instantiated whenever a new row is added.  This does cause a noticeable performance hit. Can anyone give me a clue, please?  Thanks.
0
Dimitrina
Telerik team
answered on 24 Sep 2013, 03:41 PM
Hello,

Thank you for the update.

Do you insert new row pressing the Insert key? What is the result if you set ShowInsertRow and use it for inserting new rows? 


Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Don
Top achievements
Rank 1
answered on 24 Sep 2013, 04:55 PM
Rows are added and deleted programatically by using the Add() and Remove() methods in the ObservableCollection class that is bound to the ItemsSource property of the RadGridView.  I am doing no direct operations on the Telerik control itself.  A single Add() operation causes the control to reload all existing rows.
0
Dimitrina
Telerik team
answered on 26 Sep 2013, 03:45 PM
Hi,

I have tried to reproduce the issue, but I were not able to. You can find attached my test project.

Would you please try modifying it so that the case you describe is observed?
If I can reproduce the issue, I could advise you better.
 

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Don
Top achievements
Rank 1
answered on 26 Sep 2013, 07:03 PM
I understand that you can't help me if you can't reproduce the problem.  I've been there and bought the tee-shirt. :)

I'm preoccupied with something else in my project at the moment, I'll get back to this issue as soon as I can and try to make this problem happen using your sample code.  Thanks.
0
Accepted
Yordanka
Telerik team
answered on 27 Sep 2013, 05:42 AM
Hello Don,

We were able to reproduce the problem and the alternation is the reason for recreating all rows when a new one is added. Fortunately, this problem is addressed with RadGridView.GroupRenderMode="Flat". More information about this mode can be found on our documentation.

Let us know if you have additional questions.
 
Regards,
Yordanka
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Don
Top achievements
Rank 1
answered on 27 Sep 2013, 04:59 PM
Cool!  I'll try it out!  Thanks! :D

UPDATE: I set GroupRenderMode="Flat" and that did the trick.
Tags
GridView
Asked by
Don
Top achievements
Rank 1
Answers by
Don
Top achievements
Rank 1
Dimitrina
Telerik team
Yordanka
Telerik team
Share this question
or