Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This can be accomplished via attached behaviors.</p> <p><a href="http://josheinstein.com/blog/index.php/2010/08/wpf-nested-scrollviewer-listbox-scrolling/" rel="noreferrer">http://josheinstein.com/blog/index.php/2010/08/wpf-nested-scrollviewer-listbox-scrolling/</a></p> <p>Edit: Here is the linked solution:</p> <blockquote> <p>"So instead I came up with the following IgnoreMouseWheelBehavior. Technically it’s not ignoring the MouseWheel, but it is “forwarding” the event back up and out of the ListBox. Check it."</p> </blockquote> <pre><code>/// &lt;summary&gt; /// Captures and eats MouseWheel events so that a nested ListBox does not /// prevent an outer scrollable control from scrolling. /// &lt;/summary&gt; public sealed class IgnoreMouseWheelBehavior : Behavior&lt;UIElement&gt; { protected override void OnAttached( ) { base.OnAttached( ); AssociatedObject.PreviewMouseWheel += AssociatedObject_PreviewMouseWheel ; } protected override void OnDetaching( ) { AssociatedObject.PreviewMouseWheel -= AssociatedObject_PreviewMouseWheel; base.OnDetaching( ); } void AssociatedObject_PreviewMouseWheel(object sender, MouseWheelEventArgs e) { e.Handled = true; var e2 = new MouseWheelEventArgs(e.MouseDevice,e.Timestamp,e.Delta); e2.RoutedEvent = UIElement.MouseWheelEvent; AssociatedObject.RaiseEvent(e2); } } </code></pre> <blockquote> <p>And here’s how you would use it in XAML.</p> </blockquote> <pre><code>&lt;ScrollViewer Name="IScroll"&gt; &lt;ListBox Name="IDont"&gt; &lt;i:Interaction.Behaviors&gt; &lt;local:IgnoreMouseWheelBehavior /&gt; &lt;/i:Interaction.Behaviors&gt; &lt;/ListBox&gt; &lt;/ScrollViewer&gt; </code></pre> <p>Where the i namespace is from Blend: </p> <pre><code> xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload