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

LoadOnDemand for UWP

2 Answers 31 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 12 Dec 2018, 11:48 PM

Hi,

I have spent days trying to get Xamarin Forms RadTreeView LoadOnDemand to work properly for a UWP app that is referencing the Xamarin Forms app.  I can debug break the code at the load command and see that the data is loading properly into the context and the treeview icon indicates that it is expanded, but the new sub items will not show up.   I have tried with datatemplate, without template, with various types of collections, manually calling OnPropertyChanged, using the ItemTapped event instead instead of LoadOnDemand, all with the same results.  

 

I believe it is a bug because when I load all the data initially, it will show up properly in the tree.  However, I have found no way to initialize the tree in a collapsed state (even if I call CollapseAll which doesn't do anything).  It's as if the treeview is never getting refreshed if the ItemsSource data changes after the page loads. 

 

Do you have a simple working UWP example with LoadOnDemand?  The GitHub QSF projects have so many compilation errors that I can't get them to work. 

 

I'm using Telerik.UI.for.Xamarin (2018.3.1122.3)

 

Thanks,

Ian

 

private void LoadOnDemandExecute(object p)
       {
           var context = (TreeViewLoadOnDemandCommandContext)p;
 
           var platform = context.Item as TreePlatform;
           if (platform != null)
           {
               platform.Groups = new List<TreeGroup>();
               platform.Groups.Add(new TreeGroup() { Name = "test"});
               context.Finish();
           }
       }

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 13 Dec 2018, 12:01 PM
Hello Ian,

I am sorry to hear about these issues with load-on-demand feature of RadTreeView.  I'd suggest you take a look at our SDK example here:
https://github.com/telerik/xamarin-forms-sdk/tree/master/XamarinSDK/SDKBrowser/SDKBrowser/Examples/TreeViewControl/FeaturesCategory/LoadingItemsExample

on which actually our documentation article is based (TreeView: Load on Demand).

In addition, looking at your code I noticed you have two types of objects  - TreePlatform which I guess defines the root notes and TreeGroup which seems to mark the children nodes.  Please note that this means you'd need to add two TreeViewDescriptors to define the data items' hierarchy you're using.  For more details on this, check the TreeView Getting Started topic. Also you could take a look at the treeview descriptors in the previously referenced load-on-demand article where two different types of items are used as well.

I hope this would be helpful. If you still experience any issues with this, please send us a sample demo project, so we could research it further.

Regards,
Yana
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ian
Top achievements
Rank 1
answered on 05 Feb 2019, 04:34 PM
Just to close this out, the issue turned out to be a problem with ObservableCollections not raising propertychanged events.  Resolved now. 
Tags
TreeView
Asked by
Ian
Top achievements
Rank 1
Answers by
Yana
Telerik team
Ian
Top achievements
Rank 1
Share this question
or