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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

What is the equivalent of SortMemberPath in SFDataGrid

Thread ID:





146936 Aug 26,2019 11:28 AM UTC Sep 2,2019 10:04 AM UTC WPF 3
Tags: SfDataGrid
Qasim Raza
Asked On August 26, 2019 11:28 AM UTC

I am looking for an alternate of SortMemberPath in SFDataGrid.

Could you share the name with an example ASAP?

Best Regards,

Farjana Parveen Ayubb [Syncfusion]
Replied On August 27, 2019 11:21 AM UTC

Hi Qasim, 
Thank you for using Syncfusion controls. 
You can able to achieve the SortMemberPath behavior in SfDataGrid by using custom sorting support. 
Please refer the below code example 
    <Linq:SortComparer Comparer="{StaticResource Comparer}" PropertyName="ShipCity" /> 
public class CustomerInfo : IComparer<Object>, ISortDirection 
    public int Compare(object x, object y) 
        int namX; 
        int namY; 
        if (x.GetType() == typeof(Orders)) 
            namX = ((Orders)x).OrderID; 
            namY = ((Orders)y).OrderID; 
        else if (x.GetType() == typeof(Group)) 
            namX = ((Group)x).Key.ToString().Length; 
            namY = ((Group)y).Key.ToString().Length; 
            namX = x.ToString().Length; 
            namY = y.ToString().Length; 
        if (namX.CompareTo(namY) > 0) 
            return SortDirection == ListSortDirection.Ascending ? 1 : -1; 
        else if (namX.CompareTo(namY) == -1) 
            return SortDirection == ListSortDirection.Ascending ? -1 : 1; 
            return 0; 
    private ListSortDirection _SortDirection; 
    public ListSortDirection SortDirection 
        get { return _SortDirection; } 
        set { _SortDirection = value; } 
Please let us know if you need any further details on this. 
Farjana Parveen A 

Replied On August 30, 2019 07:31 AM UTC

That's an useful info.

Susmitha Sundar [Syncfusion]
Replied On September 2, 2019 10:04 AM UTC

Hi Thymopathy,     
Thanks for the update.    
Please get back to us if you require further assistance from us.     
Susmitha S   


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