locked
Best way to manage JSON data in memory when bound to a WinJS.Binding.List?

    Question

  • I have some data stored in remote settings, that is bound to a WinJS.Binding.List used to populate a listview. The Binding.List is the only thing defined in the namespace currently.

    The user has an option to add an item to the list.

    What is the appropriate process for adding an item to the list? Do I expose the array to the UI, add to the array and the rebind everything? Or do I push to the Binding.List?  Or am I missing something else obvious?

    S


    Check out my new C# 2010 All In One for Dummies book at Amazon!

    Thursday, May 24, 2012 5:54 PM

Answers

  • Push to the Binding List.  The ListView will update with the appropriate animation.

    (Of course, you can initialize the Binding List with an array of objects in its constructor.  But after that, use the methods on the Binding List.)

    • Edited by jrboddie Thursday, May 24, 2012 6:31 PM
    • Marked as answer by Bill SempfMVP Thursday, May 24, 2012 7:09 PM
    Thursday, May 24, 2012 6:26 PM

All replies

  • Push to the Binding List.  The ListView will update with the appropriate animation.

    (Of course, you can initialize the Binding List with an array of objects in its constructor.  But after that, use the methods on the Binding List.)

    • Edited by jrboddie Thursday, May 24, 2012 6:31 PM
    • Marked as answer by Bill SempfMVP Thursday, May 24, 2012 7:09 PM
    Thursday, May 24, 2012 6:26 PM
  • Thanks.

    Check out my new C# 2010 All In One for Dummies book at Amazon!

    Thursday, May 24, 2012 7:10 PM