1

I have DataGrid and other elements contained within the ScrollViewer and want to find out how it is possible to delegate DataGrid scrolling on the outer ScrollViewer. I mean if the mouse pointer is not on the DataGrid - scrolling is executed on the containing ScrollViewer, but once the mouse pointer is on the DataGrid - it will scroll instead of "main" ScrollViewer.

Here is the code snippet:

<ScrollViewer>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Content1/>

        <DataGrid Grid.Row="1"/>

        <Content2 Grid.Row="2"/>
    </Grid>
</ScrollViewer>

Is there any way to merge scrolling between the outer ScrollViewer and contained DataGrid?

Arthur Edgarov
  • 473
  • 5
  • 16
  • I guess I need to disable `DataGrid` scrolling to make it scrollable for the outer `ScrollViewer`. – Arthur Edgarov Mar 31 '22 at 12:49
  • Check out this question: https://stackoverflow.com/questions/15151974/synchronized-scrolling-of-two-scrollviewers-whenever-any-one-is-scrolled-in-wpf – Fruchtzwerg Mar 31 '22 at 14:11
  • @Fruchtzwerg, thanks for the info, but it seems the question title was a bit confusing. I changed it to describe my goal more accurately. – Arthur Edgarov Mar 31 '22 at 14:18

0 Answers0