Hi,
I wanted to do something similar to the Sorting example in your sample so I created a class inheriting from DataModelSortComparer. Then I overriden the Compare function like this :
public override int Compare(IDataModel x, IDataModel y)
{
// Sort the "Basic" category before anything else and "To Test" after anything else
if (x is ICategoryModel xCategoryModel && y is ICategoryModel yCategoryModel)
{
switch (xCategoryModel.Name)
{
case "Basic":
return 1;
case "To Test":
return -1;
default:
return 0;
}
}
}
As I indicated in the comment, I want to have this kind of order for my 3 categories:
- Basic
- MyCat
- To Test
But what I have is :
- MyCat
- To Test
- Basic
Do you know why ? I can't find any logic about it.
AP
Edit : I tried with four categories and it's even weirder
- To Test
- Basic
- MyCat
- FourthOne
[Modified 6 years ago]