Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8418113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:13:50+00:00 2026-06-10T02:13:50+00:00

This is what my control tree looks like: <window> <scrollviewer> <expander> <scrollviewer> <grid> </grid>

  • 0

This is what my control tree looks like:

<window>
 <scrollviewer>
  <expander>
   <scrollviewer>
    <grid>
    </grid>
   </scrollviewer>
  </expander>
  <expander>
   <scrollviewer>
    <grid>
    </grid>
   </scrollviewer>
  </expander>
 </scrollviewer>
</window>

Using the mouse wheel, the control automatically passes from parent to child scrollviewer, but when I scroll to the end of the child scrollviewer the control doesn’t pass back to the parent scorllviewer. How do I achieve this?

The expander, grid and the scrollviewers are dynamically generated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:13:52+00:00Added an answer on June 10, 2026 at 2:13 am

    I get a similar trouble in my application. I correct it by a depency property that will catch and pass the event too his parent. This can be applied to any control that have a scroll in it. But for me, i didn’t need to validate if it was at the end of the scroll to send to his parent. You will just have to add, in the OnValueChanged method, a validation for if the scroll is at the end or at the top to send to his parent.

    using System.Windows.Controls;
    
    public static class SendMouseWheelToParent
    {
       public static readonly DependencyProperty ScrollProperty
         = DependencyProperty.RegisterAttached("IsSendingMouseWheelEventToParent",
            typeof(bool),
            typeof(SendMouseWheelToParent),
            new FrameworkPropertyMetadata(OnValueChanged));
    
       /// <summary>
       /// Gets the IsSendingMouseWheelEventToParent for a given <see cref="TextBox"/>.
       /// </summary>
       /// <param name="control">
       /// The <see cref="TextBox"/> whose IsSendingMouseWheelEventToParent is to be retrieved.
       /// </param>
       /// <returns>
       /// The IsSendingMouseWheelEventToParent, or <see langword="null"/>
       /// if no IsSendingMouseWheelEventToParent has been set.
       /// </returns>
       public static bool? GetIsSendingMouseWheelEventToParent(Control control)
       {
           if (control == null)
               throw new ArgumentNullException("");
    
           return control.GetValue(ScrollProperty) as bool?;
       }
    
       /// <summary>
       /// Sets the IsSendingMouseWheelEventToParent for a given <see cref="TextBox"/>.
       /// </summary>
       /// <param name="control">
       /// The <see cref="TextBox"/> whose IsSendingMouseWheelEventToParent is to be set.
       /// </param>
       /// <param name="IsSendingMouseWheelEventToParent">
       /// The IsSendingMouseWheelEventToParent to set, or <see langword="null"/>
       /// to remove any existing IsSendingMouseWheelEventToParent from <paramref name="control"/>.
       /// </param>
       public static void SetIsSendingMouseWheelEventToParent(Control control, bool? sendToParent)
       {
           if (control == null)
               throw new ArgumentNullException("");
    
           control.SetValue(ScrollProperty, sendToParent);
       }
    
       private static void OnValueChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
       {
           var scrollViewer = dependencyObject as Control;
           bool? IsSendingMouseWheelEventToParent = e.NewValue as bool?;
           scrollViewer.PreviewMouseWheel -= scrollViewer_PreviewMouseWheel;
    
           if (IsSendingMouseWheelEventToParent != null && IsSendingMouseWheelEventToParent != false)
           {
             scrollViewer.SetValue(ScrollProperty, IsSendingMouseWheelEventToParent);
             scrollViewer.PreviewMouseWheel += scrollViewer_PreviewMouseWheel;
           }
       }
    
    
       private static void scrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
       {
           var scrollview = sender as Control;
    
           var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
           eventArg.RoutedEvent = UIElement.MouseWheelEvent;
           eventArg.Source = sender;
           var parent = scrollview.Parent as UIElement;
           parent.RaiseEvent(eventArg);
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this Tree View that looks like this: <TreeView Grid.Column=0 Grid.Row=2 MinHeight=100 MinWidth=100
I have a requirement for a Tree grid or Tree list control. This is
I have this control (see picture). I like when check one option in this
I have a custom control that inherits from .NET's CompositeControl class. This control overrides
The Get of the Visible property of a control recursively looks up the tree
My problem.. I have a PHP array that looks like this: [1013] => [1154]
I have an ItemsControl that looks something like this: <ItemsControl ItemsSource={Binding} PreviewMouseWheel=ItemsControl_PreviewMouseWheel > <ItemsControl.ItemTemplate>
I have a TreeView control from System.Windows.Controls on MainPage. <controls:TreeView x:Name=Tree SelectedItemChanged=Tree_SelectedItemChanged /> MainPage
I'm using a hierarchical tree view in Silverlight 4. This tree can be cleared
I have a control that looks along the lines of this: public class MyControl

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.