Welcome to the Xceed Community | Help
Community Search  
More Search Options

Problem sorting columns

Sort Posts: Previous Next
  •  10-07-2009, 10:32 AM Post no. 24351

    Problem sorting columns

    Hello!

    I was able to do a workaround to solve my initial problem of how to dynamicaly create a user-defined mask by using a Converter.

    Now I face a new problem in the same area with Sorting dates.

    The default format of the date is "yyyy-MM-ddTHH:mm:ss" and I mask it to "dd/MM/yyyy HH:mm:ss" and it works just fine but the Xceed WPF DataGrid column sorting feature fails to sort the column correctly. It doesn't raise any type of error. It simply re-organizes the data in the table in another way but not correctly sorted.

    How can I fix this?

    Best regards, Gil

    Filed under: , , ,
  •  10-07-2009, 3:55 PM Post no. 24359 in reply to 24351

    Re: Problem sorting columns

    Hi Gil,

    If your column is of string type, then this could be the same problem as described here:
    http://xceed.com/CS/forums/thread/20669.aspx

    If that doesn't solve it, then you may have to do some custom sorting and provide a custom sort comparer:
    http://doc.xceedsoft.com/products/XceedWpfDataGrid/How-to%20Sorting%20Data%20Items.html

     


    ** Quick Tip: Clients with an active support subscription should be sending their questions by email if they wish to benefit from the faster response time. Thanks!


    Diane Lafontaine
    Technical Support
    Xceed Software Inc.
  •  10-16-2009, 7:13 AM Post no. 24553 in reply to 24359

    Re: Problem sorting columns

    Hello!

    I resolved my problem by building from scratch my own custom comparer and associating to all columns of the WPF DataGrid.

    Custom comparer class:

    public class MyGenericComparer : IComparer



    Association:

    DataGridCollectionView dgcv = (DataGridCollectionView)TpDataGrid.ItemsSource;
    dgcv.ItemProperties.ForEach(z => z.SortComparer = new MyGenericComparer());


    Does the WPF DataGrid v3.5 have this sorting problem fixed so I won't have to do this association?

    Best regards, Gil
    Filed under:
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.