Exception when removing element

2 posts, 1 answers
  1. Doug
    Doug avatar
    49 posts
    Member since:
    May 2012

    Posted 26 Jun 2012 Link to this post


    I have a problem with the databound listbox, when I have one element in the list and I remove it, and I want to add a new element instead I get the following exception:

      at Telerik.Windows.Controls.RadDataBoundListBox.GetLastItemCacheIndex()
       at Telerik.Windows.Controls.VirtualizationStrategy.RefreshViewportOnItemAdded(IDataSourceItem addedItem)
       at Telerik.Windows.Controls.RadVirtualizingDataControl.UpdateViewportOnItemsChange(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.RadVirtualizingDataControl.OnItemsChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.RadDataBoundListBox.OnItemsChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.RadVirtualizingDataControl.OnListSource_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)

    I have also created a sample application showing what I am doing:

    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                <Telerik:RadDataBoundListBox Grid.Row="1" Name="TestListbox" DataVirtualizationMode="OnDemandAutomatic" CacheMode="BitmapCache" ItemsSource="{Binding TestStringCollection}">
                            <TextBlock Text="{Binding}" />


    namespace RadControlsWindowsPhoneApp1
        public partial class MainPage : PhoneApplicationPage
            public ObservableCollection<string> TestStringCollection { get; private set; }

            // Constructor
            public MainPage()

                TestStringCollection = new ObservableCollection<string>();

                DataContext = this;

            private void TestButtonClick(object sender, EventArgs e)
                TestStringCollection.Add("b"); //Exception here

    If I have 2 items in the listbox this doesn't happen.

    I would like you to offer a work around this and to fix it as soon as possible. Thanks in advance.

    Best Regards Doug
  2. Answer
    Deyan avatar
    2026 posts

    Posted 26 Jun 2012 Link to this post

    Hi Doug,

    Thanks for writing and for reporting this issue.

    We have been able to reproduce it and to identify the reason for it.

    A fix will be available in the upcoming Q2 2012 SP1 which is due to in a week.

    Let me know in case you have further questions or need assistance.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top