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

How to unsubscribe class handlers?

1 Answer 75 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
yogesh
Top achievements
Rank 1
yogesh asked on 28 Jan 2016, 12:10 PM
I need to unsubscribe these events

 1. EventManager.RegisterClassHandler(typeof(RadTreeViewItem), Mouse.MouseDownEvent, new MouseButtonEventHandler(OnTreeViewItemMouseDown), false);
2. RegisterClassHandler(typeof(RadTreeView), RadDragAndDropManager.DragInfoEvent, new EventHandler<DragDropEventArgs>(OnTreeViewDragInfo), false);
3. RegisterClassHandler(typeof(RadTreeView), RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnTreeViewDropQuery), true);

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 01 Feb 2016, 09:11 AM
Hello Yogesh,

EventManager doesn't provide a method for unsubscribing for the globally registered event handlers. If you want to remove a handler you can use the RemoveHandler() method of UIElement. 

Also, keep in mind that RadDragAndDropManager is our old drag/drop API. We have a new manager called DragDropManager which has better implementation and it resolves some of the issue in the old drag/drop manager. With DragDropManager you can subscribe for the events using its Add[eventname]Handler() methods and the Remove[eventname]Handler() methods for removing handlers respectively.

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TreeView
Asked by
yogesh
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or