We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Tree View Sort


This is how I am loading data from View Model to TreeView. Can you advise on how I can sort this A-Z ? 

3 Replies

LN Lakshmi Natarajan Syncfusion Team December 31, 2019 11:44 AM UTC

Hi Emad, 
Thank you for using Syncfusion products. 
We have checked the reported query from our end. We would like to let you know that you can sort the ObservableCollection which can be binded to the TreeView.ItemsSource property by adding the following code in your ViewModel class, 
        public ObservableCollection<StagingModel> loadEpics() 
            ObservableCollection<StagingModel> kk = new ObservableCollection<StagingModel>(); 
            Device.BeginInvokeOnMainThread(async () => 
                var items = await restServiceEpics.GetEpicsAsync(); 
                this.Menu = new ObservableCollection<StagingModel>(items.OrderByOrderBy(i => i.ItemName)); 
            return Menu; 
We have prepared sample for your requirement. Please refer the sample and let us know if you would require any further assistance. 
Sample link: TreeViewSort 
Lakshmi Natarajan 

EA Emad Afaq January 2, 2020 03:02 AM UTC

Thanks you :) 

GP Gnana Priya Namasivayam Syncfusion Team January 2, 2020 03:41 AM UTC

Hi Emad, 
Thanks for the update. 
We are glad that provided solution meets your requirement. Please let us know if you need any further assistance from us. We are always happy to help you out. 
Gnana Priya N 

Live Chat Icon For mobile
Up arrow icon