This repository was archived by the owner on Oct 13, 2025. It is now read-only.
Sorting template columns #348
Answered
by
Necromanika
DigVolSoft
asked this question in
Q&A
|
I can't currently find a way to sort template columns by clicking on the header. |
Answered by
Necromanika
Mar 31, 2025
Replies: 2 comments 2 replies
|
When you create a column, the constructor takes a |
1 reply
Answer selected by
DigVolSoft
|
Here’s what I used to sort a FileName column:
```
TemplateColumnOptions<MyFile> FileColOptions = new()
{
CanUserSortColumn = true,
CompareAscending = (x, y) => string.Compare(x?.FileName, y?.FileName, StringComparison.CurrentCultureIgnoreCase),
CompareDescending = (x, y) => string.Compare(y?.FileName, x?.FileName, StringComparison.CurrentCultureIgnoreCase)
};
```
James
|
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you create a column, the constructor takes a
ColumnOptionsparameter that contains theCompareAscending,CompareDescending, andCanUserSortColumnproperties. Which probably should do what you are looking for.