I have an UnboundField which I would like to be able to sort. I tried to use the SortComparer, but there is nothing to sort on. I can easily bind to the same data that I bind to for the actual data, which uses a multibinding in CellValuePresenter on a property in teh DataContext.DataItem, and the Field from the templated parent. Using version 11.1
Hello,
Thank you for your post. I have been looking into it, but I am not sure that I understands you correctly so could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
I have the project, now I need to know where to send it. You answered with a noreply email.
Thanks
Clifford
Hello Clifford,
You can attach your sample to your post using the Options tab, when you are composing your post.
As I said in my previous post, you should have values in the cells, becsaue without values if you use a SortComparer the values that will come in the Compare method will be null. I believe that the the only way to achieve the functionality you want is to modify your data as I suggested you before.
You pretty much have the code. Unfortunately, I cannot bind more than once to a property, therefore, I have a problem. Really do not want to have to modify the ViewModel if a new broker is added. Right now only have to add new broker to View. Do you have an notion of any way to proceed. It would be nice if there was someway to use the SortComparer, but does not look like there is. Can we fool the system somehow?
I have been looking into you sample and I can say that if you want to sort a Field using the built in functionality the Cells should have Values. In your case the UnboundFields doesn’t have a Binding and the cells there doesn’t have values, so you are not able to sort. If you want to do so you should modify your data, so a bool Property for example is bound to the cells where the border is visible or not so the XamDataGrid can use this value for sorting.
here is the project