ListCollectionView with LiveSorting and CustomSort with inherit

there may be collision of Compare methods.

try composition instead of inheritance:

public class NaturalTreeSorter : IComparer
{
    private NaturalStringSorter sorter = new NaturalStringSorter();

    public int Compare(object x, object y)
    {
        if (x is ITree treeX && y is ITree treeY)
        {
            return sorter.Compare(treeX.Name, treeY.Name);
        }
        else
            return 0;
    }
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top