5 Answers, 1 is accepted
Please, check the following example from our SDK Repository that demonstrates how to sort the columns of the GanttView in ascending and descending order:
https://github.com/telerik/xaml-sdk/tree/master/GanttView/GridSorting
Hope this helps.
Regards,
Nasko
Telerik by Progress
Hello
I used code from SDK Repository and have a problem: attached behavior is used for all ColumnHeaderContainer in my GanttView. How I need to modify example to perform sorting only by one of columns?
Добрый день, пробовал код из SDK и столкнулся с проблемой: теперь сортировка доступна по всем колонкам GanttView. Как его изменить чтоб сортировка была только для одного толбца?
Hello Alexander,
I've gone ahead and modified the project you referenced to allow sorting for a particular set of columns, specified by a collection property. Please find it attached to my reply.
More specifically, I've introduced a ColumnsToSort property of type ObservableCollection<string> on the ColumnHeaderExtensions class which I then bind to a collection of strings specified in the viewmodel. Lastly, I check whether the clicked ColumnDefinition's MemberBinding is one of the predefined set:
private void OnHeaderMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var columnDefinition = this.proxy.DataContext.SourceItem as ColumnDefinition;
if (columnDefinition != null && GetColumnsToSort(element).Contains(columnDefinition.MemberBinding.Path.Path))
{
// ...
Regards,
Dilyan Traykov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Yes your aproach is perfect for me. Thank you ;)
Hello Alexander,
I'm glad to hear the suggested approach works for you. Please let me know if I can further assist you with anything else.
Regards,
Dilyan Traykov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.