Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TreeViewItem.DoubleClick event continues to bubble even if e.Handled is set to true #4

Open
KirillOsenkov opened this issue May 13, 2017 · 0 comments
Labels

Comments

@KirillOsenkov
Copy link
Owner

DevDiv 207228

http://stackoverflow.com/a/36244243/37899

The bug seems to be in this code in WPF: http://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/Control.cs,5ed30e0aec6a58b2

It receives the MouseLeftButtonDown event (which is handled by the child control already), but it fails to check if e.Handled is already set to true. Then it proceeds to create a new MouseDoubleClick event args (with e.Handled == false) and invokes that always.

The question also remains why after having set it to handled the first time the event continues to bubble?
Because in this line, when we register the handler Control.HandleDoubleClick: http://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/Control.cs,40
we pass true as the last argument to RegisterClassHandler: http://referencesource.microsoft.com/#PresentationCore/Core/CSharp/System/Windows/EventManager.cs,161 which is handledEventsToo.

So the unfortunate behavior is a confluence of two factors:
1.Control.HandleDoubleClick is called always (for handled events too), and
2.Control.HandleDoubleClick fails to check if the event had already been handled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant