WPF RadGridView Fulltextsearch disables horizontal mouse scrolling.

1 Answer 150 Views
GridView
Jonas
Top achievements
Rank 1
Iron
Jonas asked on 22 Jun 2022, 03:27 PM

How to reproduce:

To simplify the problem, I used a basic RadGridView and implemented a horizontal mouse wheel scrolling like so:

  private void GridView_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (((RadGridView)sender).ChildrenOfType<ScrollViewer>().FirstOrDefault() is ScrollViewer scrollViewer)
            {
                if (Keyboard.Modifiers.Equals(ModifierKeys.Shift))
                {
                    if (e.Delta < 0)
                    {
                        scrollViewer.LineRight();
                    }
                    else
                    {
                        scrollViewer.LineLeft();
                    }
                    e.Handled = true;
                }
            }
        }

I used the solution found in this thread and added the code above.

https://www.telerik.com/forums/horizontal-scrolling-w-mouse-wheel-trackpad

 

Horizontal mouse wheel scrolling works fine until I open the text search (Ctrl + F). After opening the search bar, the ScrollViewer seems to be changed in a way that scrolling with the mouse wheel + shift behavior is not working anymore.

I would be very grateful for any help.

 

Best regards

Jonas

1 Answer, 1 is accepted

Sort by
0
Accepted
Vladimir Stoyanov
Telerik team
answered on 27 Jun 2022, 07:19 AM

Hello Jonas,

Thank you for the shared link.

When the search text box is open the ChildrenOfType<ScrollViewer>() call will find the ScrollViewer inside the TextBox that holds the search text. In order to always locate the ScrollViewer inside the RadGridView, you can search for a GridViewScrollViewer instance. Here is what I have in mind:

if (((RadGridView)sender).ChildrenOfType<GridViewScrollViewer>().FirstOrDefault() is ScrollViewer scrollViewer)
            {
                if (Keyboard.Modifiers.Equals(ModifierKeys.Shift))
                {
                    if (e.Delta < 0)
                    {
                        scrollViewer.LineRight();
                    }
                    else
                    {
                        scrollViewer.LineLeft();
                    }
                    e.Handled = true;
                }
            }

I hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Jonas
Top achievements
Rank 1
Iron
commented on 30 Jun 2022, 07:42 AM

Hello Vladimir,

works perfektly! Thank you so much.

Regards

Jonas

Tags
GridView
Asked by
Jonas
Top achievements
Rank 1
Iron
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or