I have a DataGrid
, where I am displaying some Job
data. One of the field is calculated based on 2 columns.
There is a calculated field StaffName
that comes from different properties (which are hidden in data grid).
I want to sort StaffName
based on the content displayed on grid, and not based on underlying property on which Converter
is applied. there are actually multiple underlying properties, and handling sorting of these is complex. The data structure comes from some other assembly which is not aware of any converters/lookups which transform different property into StaffName
.
How to achieve this?
You need to capture the sort event and do the Sort the itemcollection based on your need and Assign the newly sorted collection to the ItemSource . Following Link shows how to sort. Check the sample
In the example it is normal sorting, at Places LINQ queries used you need to write your own LINQ query involving the fields you want to use in the orderby clause
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.