This is a migrated thread and some comments may be shown as answers.

Cannot scroll LayoutControl content when mouse is over LayoutControlExpanderGroup content

1 Answer 675 Views
LayoutControl
This is a migrated thread and some comments may be shown as answers.
ClausDC
Top achievements
Rank 1
Iron
Iron
ClausDC asked on 24 May 2018, 09:28 AM

I have a LayoutControl which contains LayoutControlExpanderGroup-Controls.

The LayoutControl's vertical space is set to a certain height but the content overflows that. As a result, a scrollbar is displayed - which is the desired behavior.

The problem is that when the mouse pointer is over the content of a LayoutControlExpanderGroup control, scrolling with the mouse wheel does not work anymore.

When the mouse pointer is over the header of a LayoutControlExpanderGroup, it works though.

I guess the Scrollviewer in the LayoutControlExpanderGroup control "steals" the mouse wheel event? Is there any way to fix that behavior?

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 29 May 2018, 09:11 AM
Hello Claus,

You are correct. The ScrollViewer inside the layout group control handles the mouse wheel, thus disabling the scrolling of the parent ScrollViewer. You can reproduce the same behavior if you wrap a ScrollViewer inside another ScrollViewer.

To achieve your requirement you can scroll the parent ScrollViewer manually on MouseWheel. Here is an example in code:
private void RadLayoutControl_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
    var lc = (RadLayoutControl)sender;
    var sv = lc.FindChildByType<ScrollViewer>();
    double x = (double)e.Delta;
    double y = sv.VerticalOffset;
    sv.ScrollToVerticalOffset(y - x);
}

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
LayoutControl
Asked by
ClausDC
Top achievements
Rank 1
Iron
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or