Disable Mousewheel Event

5 posts, 1 answers
  1. Shawn
    Shawn avatar
    39 posts
    Member since:
    Jul 2012

    Posted 27 Jan 2010 Link to this post

    Is there a way to disable the MouseWheel scrolling in the treeview?
  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 02 Feb 2010 Link to this post

    Hello Shawn,

    The handling of the MouseWheel event is done internally, and there is no configuration exposed.

    I'm interested what is your scenario, so we can add it as a feature for the RadTreeView.

    Regards,
    Valentin.Stoychev
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Shawn
    Shawn avatar
    39 posts
    Member since:
    Jul 2012

    Posted 02 Feb 2010 Link to this post

    Here is the scenario: I have a custom built UserControl that mimics functionality similar to what a MS Project’s Gantt view does but with a few twists. On the left part of the control, we leverage the RadTreeView and the right part is our pseudo-Gantt chart which sits inside of a ScrollViewer. The user has the ability to scroll through the data either using either the timebar header at the top of the Gantt chart or by using the scrollbars when they present themselves. I have linked the Gantt Vertical Scrollbar to the RadTreeView’s vertical scrollbar in XAML and hidden the Scrollbars in the RadTreeView so that the user is always controlling movement from within the Gantt portion only. Mousewheel events are also used inside the Gantt ScrollViewer control for navigation.

    Everything works correctly until the user performs a Mousewheel event inside the treeview control which causes the two controls to become out of sync.

    As I am writing this, I realized that one possible solution is to just capture the ScrollViewer events within the RadTreeView and force an update to match in the Gantt’s ScrollViewer but I’m not sure if that would cause a circular reference/update loop.

    I’ve attached screenshots to help make the above a little bit easier to understand.


    Regards,
    Shawn
  5. Answer
    Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 03 Feb 2010 Link to this post

    Hello Shawn,

    You can use the PreviewMouseWheel event to handle the MouseWheel. Sorry for not mentioning this the first time. Here is the code:
    XAML:
    <TreeView Height="100" PreviewMouseWheel="TreeView_PreviewMouseWheel">

    Code Behind:
    private void TreeView_PreviewMouseWheel(object sender, MouseWheelEventArgs e) {

       e.Handled = true;

    }



    Best wishes,
    Valentin.Stoychev
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  6. Shawn
    Shawn avatar
    39 posts
    Member since:
    Jul 2012

    Posted 03 Feb 2010 Link to this post

    Thanks Valentin, that worked perfectly.

    Shawn
Back to Top
UI for WPF is Visual Studio 2017 Ready