views:

85

answers:

1

I am using a Telerik GridView, and having an issue trying to sort a column that is made of of a List<>. In this forum entry, the Telerik team states that the grid can sort IComparable and group/filter IEquatable<> no matter of the Silverlight version. In the xaml below, you will see the four columns that I have in my grid. The SVOs column is the one that I'm having the issue with. SVOs is bound to a List(ServiceOrder_DataViewModel). Since a List does not implement IComparable or IEquatable, I cannot sort or group/filter this column. So, my question is: how do I create a new List object that implements IComparable and IEquatable? We do have logic to be able to implement the IComparable and IEquatable, I'm just not sure how to implement it. Any help would be greatly appreciated!

<d:MVVMRadGridView.Columns>
    <telerikGridView:GridViewDataColumn Header="Case Id" UniqueName="Id" CellTemplate="{StaticResource CaseIDLinkCellTemplate}" DataMemberBinding="{Binding Id}" DisplayIndex="0" IsVisible="True" />
    <telerikGridView:GridViewDataColumn Header="SVOs" UniqueName="SVOs" CellTemplate="{StaticResource CaseServiceOrdersLinksCellTemplate}" DisplayIndex="1" IsVisible="True" TextWrapping="Wrap" />
    <telerikGridView:GridViewDataColumn Header="Type" UniqueName="Type" DataMemberBinding="{Binding Type}" DisplayIndex="2" IsVisible="True" TextWrapping="Wrap" />
    <telerikGridView:GridViewDataColumn Header="Status" UniqueName="Status" DataMemberBinding="{Binding Status}" DisplayIndex="3" IsVisible="True" />
</d:MVVMRadGridView.Columns>
+1  A: 

Can you just extend the list class and implement the IComparable and IEquatable methods?

public class ComparableList<T> : List<T>, 
   IComparable<List<T>>, IEquatable<List<T>> 
{
    // Implement IComparable and IEquatable using your rules.
}
Eric Petroelje
This is exaclty what I needed! Thanks!With your suggestion, I was able to create the ComparableList successfully. Still having issues with the Telerik grid, but that's another issue :)
JSprang