This is a migrated thread and some comments may be shown as answers.

Disable Mousewheel Event

4 Answers 512 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 27 Jan 2010, 07:12 PM
Is there a way to disable the MouseWheel scrolling in the treeview?

4 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 02 Feb 2010, 03:54 PM
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.
0
David
Top achievements
Rank 1
answered on 02 Feb 2010, 04:47 PM

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
0
Accepted
Valentin.Stoychev
Telerik team
answered on 03 Feb 2010, 01:01 PM
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.
0
David
Top achievements
Rank 1
answered on 03 Feb 2010, 03:57 PM
Thanks Valentin, that worked perfectly.

Shawn
Tags
TreeView
Asked by
David
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
David
Top achievements
Rank 1
Share this question
or