I have a GridView nested in a Scrollable control. By default, when the GridView contains the cursor, it handles mouse-wheel events. That is, it blocks its parent container from scrolling. Is there a way to prevent this? I want the parent to scroll with the mouse wheel, never the grid.
var child = new GridView(){...};
ScrollHelper.ScrollParent(child);
public class ScrollHelper
{
public static void ScrollParent(Control c)
{
if (c == null) return;
c.MouseWheel += (sender, args) =>
{
if (c.Parents == null) return;
foreach (var p in c.Parents)
{
if (p is Scrollable s)
{
s.ScrollPosition = new Point(s.ScrollPosition.X,
(int) (s.ScrollPosition.Y - (args.Delta.Height * 10)));
}
}
args.Handled = true;
};
}
}