GridViewItemContainerGenerator.Remove

3 posts, 0 answers
  1. Ahmet Özgür
    Ahmet Özgür avatar
    37 posts
    Member since:
    Jul 2009

    Posted 16 Jul 2010 Link to this post

    Hello,
    Sorry for the bad title. I could not guess what kind of an problem it was.
    Bellow is our .xaml and .cs codes. After adding an amount of values to the grid, the grid throws an exception. I gave all of the code at the page because there was another thread about this subject and "telerik" had requested to code.
    Generally it gives the error after 20-30 records added to the grid.

    The computer specs where the application is used:
    1. Ultra mobile pc
    2. Atom processor
    3. Windows 7 with .net framework 3.5

    we are using 2010.1.603.35 version of telerik.


    <base:PageBase x:Class="Shop.App.WPF.Pages.Secured.CycleCount.PageCycleCount"
          xmlns:base="clr-namespace:Shop.App.WPF.Pages.Base"
          mc:Ignorable="d"
          d:DesignHeight="600" d:DesignWidth="900"
        Title="Sayım">
     
        <Grid DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type base:PageBase}, Mode=FindAncestor}, Path=CycleCountService}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
             
            <StackPanel Grid.Row="0" Orientation="Horizontal" >
                <TextBlock Margin="5" Style="{StaticResource StyleTextBlock}" VerticalAlignment="Center" Text="Depo"></TextBlock>
                <ComboBox Name="ComboBoxWarehouse" MinWidth="150" Margin="5" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type base:PageBase}, Mode=FindAncestor}, Path=WarehouseContext.Values}" SelectedIndex="0" DisplayMemberPath="Name" SelectionChanged="ComboBoxWarehouse_SelectionChanged"></ComboBox>
            </StackPanel>
             
            <StackPanel Grid.Row="1" Orientation="Horizontal">
                <TextBlock Style="{StaticResource StyleTextBlock}" Text="Stok Kodu" Margin="5" VerticalAlignment="Center"></TextBlock>
                <TextBox Margin="5" VerticalAlignment="Center" Name="TextBoxItemStockCode" Width="200" KeyDown="TextBoxItemStockCode_KeyDown"></TextBox>
                <TextBlock Style="{StaticResource StyleTextBlock}" Text="Adet" Margin="5" VerticalAlignment="Center"></TextBlock>
                <Telerik:RadNumericUpDown Margin="5" Minimum="1" IsInteger="True" x:Name="NumericPieces"></Telerik:RadNumericUpDown>
                <TextBlock Text="{Binding Path=ProductDataContext.Value.ItemName}" Margin="5" VerticalAlignment="Center" Name="TextBlockItemName" Width="Auto" TextWrapping="Wrap"></TextBlock>
            </StackPanel>
             
            <Telerik:RadGridView
                Margin="5"
                Grid.Row="2"
                x:Name="GridItems"
                AutoGenerateColumns="False"
                ItemsSource="{Binding Path=CycleCountItemContext.Values}"
                >
                <Telerik:RadGridView.Columns>
                    <Telerik:GridViewDataColumn Header="Stok Kodu" DataMemberBinding="{Binding Path=ItemStockCode}"></Telerik:GridViewDataColumn>
                    <Telerik:GridViewDataColumn Header="Stok Adı" DataMemberBinding="{Binding Path=ItemName}"></Telerik:GridViewDataColumn>
                    <Telerik:GridViewDataColumn Header="Stok Bakiye" DataMemberBinding="{Binding Path=StartCount}"></Telerik:GridViewDataColumn>
                    <Telerik:GridViewDataColumn Header="Satılan Miktar" DataMemberBinding="{Binding Path=SoldCount}"></Telerik:GridViewDataColumn>
                    <Telerik:GridViewDataColumn Header="Sayılan" DataMemberBinding="{Binding Path=Counted}"></Telerik:GridViewDataColumn>
                    <Telerik:GridViewDataColumn Header="Son Bakiye" DataMemberBinding="{Binding Path=EndCount}"></Telerik:GridViewDataColumn>
                    <Telerik:GridViewDataColumn Header="Kategori" DataMemberBinding="{Binding Path=Product.Category.Name}"></Telerik:GridViewDataColumn>
                </Telerik:RadGridView.Columns>
            </Telerik:RadGridView>
        </Grid>
    </base:PageBase>

    namespace Shop.App.WPF.Pages.Secured.CycleCount
    {
        /// <summary>
        /// Interaction logic for PageCycleCount.xaml
        /// </summary>
        public partial class PageCycleCount : PageBase, INotifyPropertyChanged
        {
            private WarehouseContext _WarehouseContext;
     
            public WarehouseContext WarehouseContext
            {
                get { return _WarehouseContext; }
                set
                {
                    _WarehouseContext = value;
                    PropertyChanged(this, new PropertyChangedEventArgs("WarehouseContext"));
                }
            }
     
            private CycleCountService _CycleCountService = null;
            public CycleCountService CycleCountService
            {
                get
                {
                    return _CycleCountService;
                }
                set
                {
                    _CycleCountService = new CycleCountService();
                    PropertyChanged(this, new PropertyChangedEventArgs("CycleCountService"));
                }
            }
     
            public PageCycleCount()
            {
                PropertyChanged += new PropertyChangedEventHandler(PageCreateNew_PropertyChanged);
     
                CycleCountService = new Business.Services.CycleCountService();
                WarehouseContext = new Business.Contexts.WarehouseContext();
                InitializeComponent();
     
                WarehouseContext.LoadAll();
                CycleCountService.LoadActiveCountItems(WarehouseContext.Values.FirstOrDefault().ID);
            }
     
            void PageCreateNew_PropertyChanged(object sender, PropertyChangedEventArgs e)
            {
     
            }
     
            #region INotifyPropertyChanged Members
     
            public event PropertyChangedEventHandler PropertyChanged;
     
            #endregion
     
            private void TextBoxItemStockCode_KeyDown(object sender, KeyEventArgs e)
            {
                CycleCountItem item = null;
     
                try
                {
                    if (e.Key == Key.Enter)
                    {
                        item = CycleCountService.AddCount(
                            (ComboBoxWarehouse.SelectedItem as Warehouse).ID,
                            TextBoxItemStockCode.Text,
                            Convert.ToInt32(NumericPieces.Value));
                        NumericPieces.Value = 1;
                        GridItems.ScrollIntoView(item);
                        GridItems.SelectedItem = item;
                        TextBoxItemStockCode.Text = "";
     
                        CycleCountService.LoadActiveCountItems((ComboBoxWarehouse.SelectedItem as Warehouse).ID);
                    }
                }
                catch (UserException exc)
                {
                    SendErrorMessage(exc.Message);
                }
                catch (Exception exc)
                {
                    CommonExceptionAction(exc);
                }
            }
     
            private void ComboBoxWarehouse_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                try
                {
                    CycleCountService.LoadActiveCountItems((ComboBoxWarehouse.SelectedItem as Warehouse).ID);
                }
                catch (UserException exc)
                {
                    SendErrorMessage(exc.Message);
                }
                catch (Exception exc)
                {
                    CommonExceptionAction(exc);
                }
            }
        }
    }

    The Error :

    PresentationHost.exe Error: 0 : System.NullReferenceException:
    target: Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.Remove(GeneratorPosition position, Int32 count, Boolean isRecycling)
       target: Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.System.Windows.Controls.Primitives.IRecyclingItemContainerGenerator.Recycle(GeneratorPosition position, Int32 count)
       target: Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.CleanupRange(IList children, IItemContainerGenerator generator, Int32 startIndex, Int32 count)
       target: Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.CleanupContainers(Int32 firstViewport, BaseItemsControl itemsControl)
       target: Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       target: System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       target: System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       target: System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       target: System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       target: System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
       target: System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Control.MeasureOverride(Size constraint)
       target: Telerik.Windows.Controls.GridView.GridViewDataControl.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       target: System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       target: System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       target: System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Page.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       target: System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Control.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       target: System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       target: System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Control.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       target: System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       target: System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Control.MeasureOverride(Size constraint)
       target: Telerik.Windows.Controls.RadTabControl.MeasureOverride(Size availableSize)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       target: System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Control.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: Telerik.Windows.Controls.DockingPanel.MeasureOverride(Size availableSize)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Control.MeasureOverride(Size constraint)
       target: Telerik.Windows.Controls.RadDocking.MeasureOverride(Size availableSize)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       target: System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       target: System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       target: System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Page.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       target: System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
       target: System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Controls.Border.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.Window.MeasureOverrideHelper(Size constraint)
       target: System.Windows.Window.MeasureOverride(Size availableSize)
       target: MS.Internal.AppModel.RootBrowserWindow.MeasureOverride(Size constraint)
       target: System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       target: System.Windows.UIElement.Measure(Size availableSize)
       target: System.Windows.ContextLayoutManager.UpdateLayout()
       target: System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
       target: System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
       target: System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       target: System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
       target: System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
       target: System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
       target: System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 21 Jul 2010 Link to this post

    Hi Ahmet Özgür,

    We would like to ask you to prepare a runnable sample project, open a separate support ticket and attach it.
    The project must reproduce the behavior that you are faced with. Also, tell us what are the exact steps that we need to take in order to exhibit the behavior. Thanks in advance.

    Sincerely yours,
    Ross
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dogu Tumerdem
    Dogu Tumerdem avatar
    39 posts
    Member since:
    Sep 2006

    Posted 21 Jul 2010 Link to this post

    Hi,
    Actually we have difficulties in regenerating the exception in 2010.Q1.SP2 but we had a strong feeling about memory shortage.
    But it seems solved in 2010.Q2.

    Thank you,
    Dogu
Back to Top