Optimized Adds don't work?

4 posts, 0 answers
  1. Bob
    Bob avatar
    9 posts
    Member since:
    Nov 2010

    Posted 01 May 2012 Link to this post

    Hi,

    I have a RadTreeListView (version 2011.2.712.35) whose ItemsSource is a custom implementation of INotifyCollectionChanged. The custom version is intended to be more efficient than ObservableCollection by bundling multiple sequential Adds or Removes into a single NotifyCollectionChanged event. The single event has a list of NewItems or OldItems with more than one item in it.

    The RadTreeListView seems unable to handle this event correctly. In response to an Add event with two items, it only updates the display with the first of the items. In response to an Add event with 5 items, only the first two appear in the display.

    Is this a known problem? Has it been fixed in a later version than the one I have?

    Thanks,
       Bob
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 01 May 2012 Link to this post

    Hello Bob ,

    Please try using RadObservableCollection instead of your custom implementation. It supports the suspend/resume notifications pattern.

    Regards,
    Pavel Pavlov
    the Telerik team

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

  3. UI for WPF is Visual Studio 2017 Ready
  4. Bob
    Bob avatar
    9 posts
    Member since:
    Nov 2010

    Posted 01 May 2012 Link to this post

    Hi Pavel,

    There's two reasons I don't want to use RadObservableCollection. First, my custom collection is providing other features in addition to bundling multiple actions into one event. Second, RadObservableCollection combines multiple actions into a single Reset event. This means RadTreeListView has to re-evaluate the entire list. That's potentially a lot of wasted work. Imagine, for example, a list of 100 items where two items are added. It's much faster to process two new items than to process 102 items.

    But I fear from your response that the answer to my question is that RadTreeListView does not support multiple changes in a single event, and it's not going to any time soon. Am I correct?

    - Bob
  5. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 02 May 2012 Link to this post

    Hi Bob,

    Indeed in case of more than one item added/removed  RadGridView and RadTreeListView  would  rely on the Reset action. In the general this has proven to be the cheaper approach in the context of memory and performance.  If we handle individually each add/remove action when batch updates are performed with the current  architecture of RadTreeListView the end result would be near to performance disaster.

    Regards,
    Pavel Pavlov
    the Telerik team

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

Back to Top