title: Mouse scroll not working in a scroll viewer with a wpf datagrid and additional UI elements
body: <p>I am trying to figure out how to get the mouse scroll working on a wpf window with a scrollviewer and a datagrid within it. The WPF and C# code is below</p>
  
  <pre><code>&lt;ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"&gt;
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition/&gt;
              &lt;RowDefinition/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Grid Grid.Row="0"&gt;
  
              &lt;Border Name="DataGridBorder" BorderThickness="2"  Margin="1" CornerRadius="4" BorderBrush="#FF080757"&gt;
                  &lt;dg:DataGrid AutoGenerateColumns="False" Name="ValuesDataGrid" 
                           BorderThickness="0" CanUserResizeColumns="True" FontWeight="Bold" HorizontalScrollBarVisibility="Auto" 
                           CanUserReorderColumns="False" IsReadOnly="True" IsTextSearchEnabled="True" AlternationCount="2"
                           SelectionMode="Extended" GridLinesVisibility="All"                
                           HeadersVisibility="Column" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" CanUserSortColumns="False"
                           RowDetailsVisibilityMode="Collapsed"  SelectedIndex="0"
                           RowStyle="{StaticResource CognitiDataGridRowStyle}"
                           &gt;
  
                      &lt;dg:DataGrid.Columns&gt;
                          &lt;dg:DataGridTemplateColumn Header="Title" &gt;
                              &lt;dg:DataGridTemplateColumn.CellTemplate&gt;
                                  &lt;DataTemplate&gt;
                                      &lt;StackPanel Orientation="Horizontal" &gt;
                                          &lt;TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Path=Name}" FontWeight="Normal"  /&gt;
                                      &lt;/StackPanel&gt;
                                  &lt;/DataTemplate&gt;
                              &lt;/dg:DataGridTemplateColumn.CellTemplate&gt;
                          &lt;/dg:DataGridTemplateColumn&gt;
                      &lt;/dg:DataGrid.Columns&gt;
                  &lt;/dg:DataGrid&gt;
              &lt;/Border&gt;
          &lt;/Grid&gt;
          &lt;Button Grid.Row="1" Height="90" &gt;hello world&lt;/Button&gt;
      &lt;/Grid&gt;
  &lt;/ScrollViewer&gt;
  </code></pre>
  
  <p>and the C# code is as follows</p>
  
  <pre><code> public partial class Window1 : Window
    {
       public Window1()
       {
          InitializeComponent();
          initialize();
        }
  
      public void initialize()
      {
          ObservableCollection&lt;MyObject&gt; testList = new ObservableCollection&lt;MyObject&gt;();
  
          for (int i = 0; i &lt; 20; i++)
          {
              MyObject my = new MyObject("jack " + i);
              testList.Add(my);
          }
  
          ValuesDataGrid.ItemsSource = testList;
  
  
  
      }
  }
  
  public class MyObject
  {
      public string Name { get; set; }
  
  
  
      public MyObject(string name)
      {
          Name = name;
      }
     }
  </code></pre>
  
  <p>The problem i am facing is that when using the mouse to scroll, it works fine when it is over the button but as soon as i move the mouse pointer over the grid and try to scroll, nothing happens. I am able to move the scrollbar of the scrollviewer directly though. I am still a wpf novice so any help on how to get the mouse scroll to work over the datagrid would be appreciated. I am guessing there should be a pretty easy solution for this but I havent been able to figure it out</p>