RadMultiColumnComboBox how to add SortDescriptors to GridViewItemsSourceProvider?

1 Answer 149 Views
MultiColumnComboBox
ClausDC
Top achievements
Rank 1
Iron
Iron
ClausDC asked on 17 May 2022, 08:12 AM | edited on 17 May 2022, 09:06 AM

How can I add Sorting to the DropDown GridView, so that when the User first opens the DropDown, the GridView is already sorted on one or more columns?

ClausDC
Top achievements
Rank 1
Iron
Iron
commented on 17 May 2022, 08:51 AM

This should be in the WPF sub forum.

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin Ivanov
Telerik team
answered on 19 May 2022, 02:48 PM

Hello Claus,

You can achieve your requirement using the InitializeDropDownContentManager event of RadMultiColumnComboBox. In the event handler, you can get the RadGridView control and populate its SortDescriptors. For example:

private void RadMultiColumnComboBox_InitializeDropDownContentManager(object sender, Telerik.Windows.Controls.MultiColumnComboBox.DropDownContentManagerEventArgs e)
{
	var gridView = (RadGridView)e.DropDownContentManager.DropDownElement;
	gridView.SortDescriptors.Add(new SortDescriptor() { Member = "MyProperty", SortDirection = ListSortDirection.Descending });
}

Regards,
Martin Ivanov
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/.

ClausDC
Top achievements
Rank 1
Iron
Iron
commented on 20 May 2022, 07:03 AM

Perfect, thanks!
Tags
MultiColumnComboBox
Asked by
ClausDC
Top achievements
Rank 1
Iron
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or