Updating Timeline

3 posts, 1 answers
  1. Amige
    Amige avatar
    48 posts
    Member since:
    Dec 2013

    Posted 06 Apr 2015 Link to this post


    In my application I need to update the ItemsSource every few seconds, I would like to know what would be the best way to perform this.

    I might have up to 600 items divides

    I have an ObervableCollection object, every time I receive new data I clear the ObervableCollection object and then I add the new data, something like this:

    ObservableCollection<myData> myCollection = new ObservableCollection<myData>();
    // Format the data the way I need it
    foreach (myObject item in DataObject)
      myCollection.Add(new myData()
            property1 = item.property1,
            property2 = item.property2,
            property3 = item.property3
            // Operations for other properties

    I wonder if it would be better to update my ObervableCollection object (update existing items, add the new ones, and delete those that no longer exist) than clear and add all again.

    What I want to achieve is to reduce the rendering time.

    I hope you can give me some advice.

    Thanks in advance,





  2. Answer
    Petar Marchev
    Petar Marchev avatar
    996 posts

    Posted 08 Apr 2015 Link to this post

    Hi Amige,

    When the items source changes in any way, the whole timeline is redrawn. This is due to various reasons, such as if the timeline uses grouping and an item changes - the number of groups or order of groups may change. So all previous items are released and new ones are created.

    With this being said, we think that you will get the same performance in all cases. However, if you need to you can try both approaches and see if you detect any difference in the performance. Let us know if you need more information.

    Petar Marchev

    See What's Next in App Development. Register for TelerikNEXT.

  3. Amige
    Amige avatar
    48 posts
    Member since:
    Dec 2013

    Posted 08 Apr 2015 in reply to Petar Marchev Link to this post

    Hello Petar,

    Thanks for claryfing me the way the timeline is redrawn.

    I'll try the second approach and see if the performance improves a little.



Back to Top