Ticket T1109891
Visible to All Users

GroupBox may have mousewheel event response problems when its contents include a scrollviewer

created 3 years ago

When I nested the scrollviewer control in the GroupBox and wrote the mouse wheel event for the scrollviewer, I found that not only the scrollviewer responded to my event, but the GroupBox also slid the content in my Scrollview up and down. Even if I override the mouse wheel event in Scrollview (mark e.handel = true), it seems not work.
Is that a bug for GroupBox? This kind of behavior doesn't seem to be intuitive and it confused me in my UI development

Answers approved by DevExpress Support

created 3 years ago

Hello,
GroupBox has its own extended scrolling mechanism (it doesn't contain its own ScrollViewer) that also handles the mouse wheel action. So, although this behavior can be undesired, it is expected. Also, GroupBox is designed to be used only inside LayoutControl. So, if you use this element as a separate container for DockLayoutManager, I recommend that you replace it with LayoutControl and disable its scrolling logic by setting the attached ScrollBarExtensions.AllowMouseScrolling property to false:

XAML
<dxlc:LayoutControl Grid.Row="0" Grid.Column="0" dx:ScrollBarExtensions.AllowMouseScrolling="False"> <dxdo:DockLayoutManager x:Name="DockManager1" FloatingMode="Desktop" AllowCustomization="False" AllowMergingAutoHidePanels="False" ManualClosedPanelsBarVisibility="True" ClosedPanelsBarPosition="Bottom" ClosedPanelsBarVisibility="Auto"> <dxdo:LayoutGroup> <dxdo:DocumentGroup> <dxdo:DocumentPanel Caption="TestScrollView"> <Grid Margin="0,0,0,0"> <local:ImageViewer x:Name="Viewer1" /> </Grid> </dxdo:DocumentPanel> </dxdo:DocumentGroup> </dxdo:LayoutGroup> </dxdo:DockLayoutManager> </dxlc:LayoutControl>

If you still need to use the GroupBox element, put it to LayoutControl and set the ScrollBarExtensions.HandlesDefaultMouseScrolling property to "False" inside your UserControl:

XAML
<ScrollViewer x:Name="ScrollBar" dx:ScrollBarExtensions.HandlesDefaultMouseScrolling="False" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible"> <Grid> <Image x:Name="ImageCaptured" HorizontalAlignment="Center" VerticalAlignment="Center" RenderOptions.BitmapScalingMode="NearestNeighbor" RenderOptions.ClearTypeHint="Enabled" UseLayoutRounding="True" SnapsToDevicePixels="True" /> </Grid> </ScrollViewer>

Thanks,
Kirill

    Comments (2)

      Hello ,
             Nice to hear from you
      I have solved the problems on the project. Thank you for your answers very much

      Kirill (DevExpress Support) 3 years ago

        You are welcome! I'm happy to hear that you've resolved the issue.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.