How can I implement the touch support for multisorting in RadGridView

1 Answer 75 Views
GridView TouchManager
Nicolas
Top achievements
Rank 1
Iron
Nicolas asked on 08 Sep 2022, 04:19 PM

Hello guys,

The multisorting in RadGridView on desktop works very well with the help of "Shift" key.

But I want to implement it for the tablet computer. I want to be able to do a multisorting on my RadGridView by tapping and holding (https://docs.telerik.com/devtools/wpf/common-information/touch-support)  a column instead of the "Shift" key.

How can I do this?

Thanks in advance for your help.

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 13 Sep 2022, 08:44 AM

Hello Nicolas,

Indeed, currently, multi-column sorting is not available out-of-the-box when using a touch device. Luckily, however, enabling this is rather straightforward by handling the Sorting event:

private void Grid_Sorting(object sender, GridViewSortingEventArgs e)
{
    e.GetType().GetProperty("IsMultipleColumnSorting").SetValue(e, true, null);
}

In addition, you can enable this only for touch devices by setting a flag in the control's TouchUp event and checking this flag in the Sorting event:

private bool comingFromTouch;
 
public MainWindow()
{
    InitializeComponent();
    this.Grid.Sorting += Grid_Sorting;
    this.Grid.TouchUp += Grid_TouchUp;
}
 
private void Grid_TouchUp(object sender, TouchEventArgs e)
{
    this.comingFromTouch = true;
}
 
private void Grid_Sorting(object sender, GridViewSortingEventArgs e)
{
    if (this.comingFromTouch)
    {
        e.GetType().GetProperty("IsMultipleColumnSorting").SetValue(e, true, null);
        this.comingFromTouch = false;
    }
}

Please give this a try and let me know if this works for you.

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/.

Nicolas
Top achievements
Rank 1
Iron
commented on 15 Sep 2022, 01:29 PM

Hello,

Thanks, i'm gonna try next week. I will let you know.

Tags
GridView TouchManager
Asked by
Nicolas
Top achievements
Rank 1
Iron
Answers by
Dilyan Traykov
Telerik team
Share this question
or