views:

436

answers:

1

Hello everyone,

I created a DataGrid, that utilizes customized data cells using the DataGridTemplateColumn.CellTemplate directive. I placed a textblock inside with the Text field using a Binding to one of the ItemSource members. As the content of that member differs between "Green", "Yellow" and "Red". Everything works fine. The Foreground color of the textblock is being colored by using my own value converter.

The problem:

I want the columns with my own data cells to be sorted. But as soon as I add the right SortMemberPath they are sorted by using the text due to the binding. ("Green","Yellow","Red")

I tried to change the SortMemberPath to the general form of "{Binding MyDataMember, Converter={StaticResource myDataConverter}}" with pointing to my converter that eats the strings and outputs plain int numbers like: "Green" = 1 "Yellow" = 2 "Red" = 3 which would enable the right sorting.

But this is not allowed obviously as the parser cries when starting the application :)

Is there a way of implementing this?

Thanks a lot!

A: 

Have you seen: http://forums.silverlight.net/forums/t/89470.aspx

However I got same problem but still not solved, after doing what they said.

webKite