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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Tree View Sort

Thread ID:

Created:

Updated:

Platform:

Replies:

150287 Dec 31,2019 02:19 AM UTC Jan 2,2020 03:41 AM UTC Xamarin.Forms 3
loading
Tags: SfTreeView
Emad Afaq
Asked On December 31, 2019 02:19 AM UTC

Hi,

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


Lakshmi Natarajan [Syncfusion]
Replied On 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 
 
Regards, 
Lakshmi Natarajan 


Emad Afaq
Replied On January 2, 2020 03:02 AM UTC

Thanks you :) 

Gnana Priya Namasivayam [Syncfusion]
Replied On 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. 
 
Regards, 
Gnana Priya N 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon