Dynamic Loading of children

3 posts, 1 answers
  1. Aran
    Aran avatar
    3 posts
    Member since:
    Jun 2011

    Posted 17 Jul 2011 Link to this post

    Hi,
    I am using the control on the xaml pretty much the same way as how it's been explained in the example (please refer to documentation), so I have hierarchial list as in following:
    ExploreItem
    {
        <string> Header;
        <List of ExploreItem> Children
    }
    but I load the Children Dyamically, so by that I mean I load the children when the CurrentItem is changed, the problem that I have is that I cannot get the UI to be notified when I populate the children, I have got PropertyChanged() event to raise for all properties that I thought of but no lock so far, so please advice how to fix it up.
    Thanks,
    Aran
  2. Answer
    Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 19 Jul 2011 Link to this post

    Hi Aran,
    I guess you're experiencing this problem because you're using a List to store your Children elements. When you bind something to a collection and you want to be able to change the items in this collection dynamically (note that I said the Items, not the collection itself, the PropertyChanged() event will help you if you change the whole collection(its reference), not when you change its items) you should use a collection the implements the INotifyCollectionChanged interface. I think that the only build in collection which implements this interface is the ObservableCollection, so you should always use it when you use bindings.
    I've created a sample project so could you please examine it and if you have further questions feel free to ask.

    Kind regards,
    Zarko
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. DevCraft banner
  4. Aran
    Aran avatar
    3 posts
    Member since:
    Jun 2011

    Posted 19 Jul 2011 Link to this post

    Hi,
    It was my bad, I completely forgot to inherit from INotifyPropertyChanged, it was one of those days :)
    Thanks for your help,
    Aran
Back to Top