Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1336
MouseWheel support
posted

Hi,

I've noticed when playing with the Feature Browser that the mouse wheel works when the mouse is over the background of the control, but not when hovered over an item.

Specifically, I've styled one of our carousels the same as the "Auto-Scale Item Contents" example, which arranges the items in a vertical fashion.  We are plugging in UserControls instead of using Images but have the same problem as seen in your example - when the mouse is over the background "ellipse" it works, but when hovered over one of the contained images, it does not.

I assume some part of the item must be handling the MouseWheel event, therefore not letting it bubble up to the CarouselPanel?  Or is the panel itself forcing this behavior?

More importantly, is there anything I can do to ensure the mouse wheel always functions when the cursor is placed over any part of the control?  (in the same way that your images don't have any reason to handle the mouse wheel - nor do my user controls, they can be thought of as static images too).

Regards,

Dave

  • 69686
    posted

    Hello Dave,

    The event is handled when you are mouse wheeling above an item, you can use the following code in the PreviewMouseWheel event:

    void xamCarouselPanel1_PreviewMouseWheel(object sender, MouseWheelEventArgs e)

            {

                if (e.Delta > 0)

                {

                    xamCarouselPanel1.SetVerticalOffset(xamCarouselPanel1.VerticalOffset + 1d);

                }

                else

                {

                    xamCarouselPanel1.SetVerticalOffset(xamCarouselPanel1.VerticalOffset -1d);

                }

            }