The Los Angeles Silverlight User Group Message Board Silverlight › SL4 Datagrid sort problems with value converters

SL4 Datagrid sort problems with value converters

Tom H.
TomHannum
Reseda, CA
Post #: 3
Hi,

Using Silverlight 4/VS2010, I have a datagrid with some fields. Two of these fields have value converters to place commas into integers (12345 becomes 12,345) and date time to short date (12/03/2009 08:09:10 becomes 12/03/2009). The datagrid itemsource is a PagedCollectionView filled from a sql stored procedure.

Each column in the datagrid has canusersort=true. When I sort the columns (by clicking on the column header in the datagrid) without the value converters, they sort fine. If I remove the value conveters from the 2 columns, they sort fine. If I use the value converters, they don't sort. For the date field, the xaml looks like this:

<datagrid:DataGridTemplateColumn Header="Sale Date" Width="74" CanUserSort="True" >
<datagrid:DataGridTemplateColumn.Ce­llTemplate>
<DataTemplate>
<TextBlock Text="{Binding saledate, Converter={StaticResource DateConverter}}" VerticalAlignment="Center" HorizontalAlignment="Right" />
</DataTemplate>
</datagrid:DataGridTemplateColumn.C­ellTemplate>
</datagrid:DataGridTemplateColumn>­

Any thoughts on how to get a column to sort that has a value converter?

Thanks. Tom
A former member
Post #: 7
Very impressive thread that did great help to me on improving the knowledge of the datagrid, I think I am now more familiar with the datagrid sorting and data convert in datagrid now. This do really helps!
Powered by mvnForum

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy