This question is locked. New answers and comments are not allowed.
Using Q1 2013
I've been trying to get load on demand working with a TreeListView. I have found many posts here that point to the demo: http://demos.telerik.com/silverlight/#TreeListView/OnDemandDataLoading
I implemented my TreeListView just like the example -- except there is one big difference. The demo is just loading from an xml file - a synchronous operation. The more likely scenario in Silverlight is an asynchronous operation. In my treelistview, I call a web service when IsExpanded is set to true. When the call comes back I load the child item collection, and call NotifyPropertyChanged for the collection, however the TreeListView does NOT update. So it appears that this is not a viable option for load on demand unless I'm missing something,
To verify that its not a different issue, I populate the child collection with dummy data (synchronous) when expanded is set to true -- and the treelistview behaves correctly.
I also have a breakpoint in the return method of the service to verify there were no errors, and the child collection gets loaded with items.
My final attempt was to initialize the child collection when IsExpanded is set to true, and then just populate it when the webservice call returns -- assuming that because the collection is observable, it would update the treelistview. No luck there either.
Any thoughts? Have you made any sample projects that accesses web services?
I've been trying to get load on demand working with a TreeListView. I have found many posts here that point to the demo: http://demos.telerik.com/silverlight/#TreeListView/OnDemandDataLoading
I implemented my TreeListView just like the example -- except there is one big difference. The demo is just loading from an xml file - a synchronous operation. The more likely scenario in Silverlight is an asynchronous operation. In my treelistview, I call a web service when IsExpanded is set to true. When the call comes back I load the child item collection, and call NotifyPropertyChanged for the collection, however the TreeListView does NOT update. So it appears that this is not a viable option for load on demand unless I'm missing something,
To verify that its not a different issue, I populate the child collection with dummy data (synchronous) when expanded is set to true -- and the treelistview behaves correctly.
I also have a breakpoint in the return method of the service to verify there were no errors, and the child collection gets loaded with items.
My final attempt was to initialize the child collection when IsExpanded is set to true, and then just populate it when the webservice call returns -- assuming that because the collection is observable, it would update the treelistview. No luck there either.
Any thoughts? Have you made any sample projects that accesses web services?
<telerik:RadTreeListView Height="400" AutoExpandItems="False" IsFilteringAllowed="False" IsReadOnly="True" ItemsSource="{Binding Path=CurrentTree.ChildItems}" IsExpandedBinding="{Binding IsExpanded, Mode=TwoWay}" IsExpandableBinding="{Binding IsExpandable}"> <telerik:RadTreeListView.ChildTableDefinitions> <telerik:TreeListViewTableDefinition ItemsSource="{Binding ChildItems}" /> </telerik:RadTreeListView.ChildTableDefinitions></telerik:RadTreeListView>
public class RelationTreeItem : BaseViewModel{ private ObservableCollection<RelationTreeItem> _ChildItems; public ObservableCollection<RelationTreeItem> ChildItems { get { return _ChildItems; } protected set { _ChildItems = value; } } private bool _IsExpandable = true; public bool IsExpandable { get { return _IsExpandable; } set { if (_IsExpandable != value) { _IsExpandable = value; NotifyPropertyChanged("IsExpandable"); } } } private bool _IsExpanded = false; public bool IsExpanded { get { return _IsExpanded; } set { if (_IsExpanded != value) { _IsExpanded = value; if (_IsExpanded) LoadChildren(); NotifyPropertyChanged("IsExpanded"); } } } private void LoadChildren() { WFServiceClient client = new WFServiceClient(); client.GetItemsCompleted += delegate(object s, GetItemsCompletedEventArgs e) { client.CloseAsync(); this.ChildItems = new ObservableCollection<RelationTreeItem>(); foreach (var x in e.Result) this.ChildItems.Add(new RelationTreeItem(x))); NotifyChildrenLoaded(); }; client.GetNodeRelationshipsAsync(criteria); } protected void NotifyChildrenLoaded() { NotifyPropertyChanged("ChildItems"); }}