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

How to sort data coming from cellcontenttemplate

Sort Posts: Previous Next
  •  03-09-2012, 6:58 AM Post no. 31825

    How to sort data coming from cellcontenttemplate

    I have a column in Xceed datagrid where code is like:

    <xcdg:Colum FieldName="CorpId" CellContentTemplate="{StaticResource nameConverter}"/>

    Now FieldName is taking CorpId as value but I am using a converter to display the respective Name based on CorpId. When I am using SortDescription to perform sorting on this column, actually sorting is performed on FieldName i.e CorpId but I want to sort based on the name that i am getting from my converter.

     

    Plz help me out.

  •  03-12-2012, 1:11 PM Post no. 31831 in reply to 31825

    Re: How to sort data coming from cellcontenttemplate

     you can have them implement IComparable or, if you do not have control over the data item implementation, you can create a custom IComparable and provide it to the SortComparer property of the desired DataGridItemProperty (these are defined via the ItemProperties collection of the DataGridCollectionViewSource).

    Don't forget to bind the DataGridControl's ItemsSource property to the DataGridCollectionViewSource rather than directly to the list.

    Additional information and examples can be found in the documentation:http://doc.xceedsoft.com/products/XceedWpfDataGrid/Sorting_Data.html

    Best Regards,

    Michel Dahdah
    Technical Support
    Xceed Software inc.
  •  03-14-2012, 6:12 AM Post no. 31839 in reply to 31831

    Re: How to sort data coming from cellcontenttemplate

    I also have the same problem. Any help is accepted.

    Bathroom Remodeling
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.