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
GroupBox may have mousewheel event response problems when its contents include a scrollviewer
Answers approved by DevExpress Support
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
Hello ,
Nice to hear from you
I have solved the problems on the project. Thank you for your answers very much