title: WPF Disable mousewheel on ScrollViewer and let children handle it
body: <p>I am trying to implement an ItemsControl which contains a collection of graphing components.  The component should be able to use the MouseWheel event to zoom, but it appears that the Scrollbar is capturing and handling the event first.  Most of the articles I have found <a href="https://stackoverflow.com/questions/2189053/disable-mouse-wheel-on-itemscontrol-in-wpf">here</a> and <a href="https://stackoverflow.com/questions/3642695/how-to-prevent-scrollviewer-from-using-mousewheel-event">here</a> speak to letting parents handle the wheel, but I need the child to handle the wheel, and I can't figure out the right hooks.  Here is my TiledGrid, which is an ItemsControl at its core:</p>
  
  <pre><code>&lt;ItemsControl x:Class="Grapes.Common.Controls.TiledGrid.TiledGrid"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:local="clr-namespace:Grapes.Common.Controls.TiledGrid"
           xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
           mc:Ignorable="d"
           d:DesignHeight="300" d:DesignWidth="300" x:Name="itemsGrid" 
                ScrollViewer.CanContentScroll="True" &gt;
          &lt;!--ItemTemplate="{Binding ItemTemplate}"--&gt;
          &lt;ItemsControl.ItemTemplate&gt;
              &lt;DataTemplate&gt;
                  &lt;Border BorderBrush="Black" BorderThickness="1"
                          Padding="3" Margin="3" &gt;
                      &lt;HeaderedContentControl
                          HeaderTemplate="{Binding HeaderTemplate,ElementName=itemsGrid}" Header="{Binding}"
                          ContentTemplate="{Binding ItemTemplate,ElementName=itemsGrid}" Content="{Binding}"
                          HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                          HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
                         &gt;
                          &lt;HeaderedContentControl.Template&gt;
                              &lt;ControlTemplate TargetType="HeaderedContentControl"&gt;
                                  &lt;DockPanel&gt;
                                      &lt;ContentPresenter DockPanel.Dock="Top" ContentSource="Header" /&gt;
                                      &lt;ContentPresenter /&gt;
                                  &lt;/DockPanel&gt;
                              &lt;/ControlTemplate&gt;
                          &lt;/HeaderedContentControl.Template&gt;
                      &lt;/HeaderedContentControl&gt;
                  &lt;/Border&gt;
              &lt;/DataTemplate&gt;
          &lt;/ItemsControl.ItemTemplate&gt;
          &lt;ItemsControl.ItemsPanel&gt;
              &lt;ItemsPanelTemplate&gt;
          &lt;local:UniformGridPanel Rows="{Binding RowCount,ElementName=itemsGrid}" 
                                  Columns="{Binding ColumnCount,ElementName=itemsGrid}" 
                                &gt;
  
          &lt;/local:UniformGridPanel&gt;
              &lt;/ItemsPanelTemplate&gt;
          &lt;/ItemsControl.ItemsPanel&gt;
          &lt;ItemsControl.Template&gt;
              &lt;ControlTemplate&gt;
                  &lt;Border
          BorderThickness="{TemplateBinding Border.BorderThickness}"
          Padding="{TemplateBinding Control.Padding}"
          BorderBrush="{TemplateBinding Border.BorderBrush}"
          Background="{TemplateBinding Panel.Background}"
          SnapsToDevicePixels="True"&gt;
                      &lt;ScrollViewer
                  Padding="{TemplateBinding Control.Padding}"
                  Focusable="False" FlowDirection="RightToLeft" CanContentScroll="True" SnapsToDevicePixels="True"
                          &gt;
  
                  &lt;ItemsPresenter FlowDirection="LeftToRight"&gt;
  
                  &lt;/ItemsPresenter&gt;
                      &lt;/ScrollViewer&gt;
                  &lt;/Border&gt;
              &lt;/ControlTemplate&gt;
          &lt;/ItemsControl.Template&gt;
      &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>What can I do to stop the ScrollViewer in the ItemsControl.Template from handling the MouseWheel event?</p>
  
  <p>Thanks in Advance!</p>
  
  <p>Mike.</p>