This is a migrated thread and some comments may be shown as answers.

Dynamic Loading of children

2 Answers 79 Views
BreadCrumb
This is a migrated thread and some comments may be shown as answers.
Aran
Top achievements
Rank 1
Aran asked on 18 Jul 2011, 04:28 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Zarko
Telerik team
answered on 19 Jul 2011, 01:35 PM
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!

0
Aran
Top achievements
Rank 1
answered on 20 Jul 2011, 02:24 AM
Hi,
It was my bad, I completely forgot to inherit from INotifyPropertyChanged, it was one of those days :)
Thanks for your help,
Aran
Tags
BreadCrumb
Asked by
Aran
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Aran
Top achievements
Rank 1
Share this question
or