Added event handling settings and event-bubbling strategy#490
Open
aneteanetes wants to merge 4 commits intords1983:masterfrom
Open
Added event handling settings and event-bubbling strategy#490aneteanetes wants to merge 4 commits intords1983:masterfrom
aneteanetes wants to merge 4 commits intords1983:masterfrom
Conversation
* added EventBubbling strategy * EventArgs changed to MyraEventArgs for support EventType and custom behaviour * added StopPropagation() method for event handlers (works only with EventBubbling strategy)
Contributor
Author
|
|
* TextBox event bubbling fix
Contributor
Author
|
|
a105205 to
3c691c7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
For now Myra handle events from controls from 'outer' to 'nested', i.e.:
In this PR i added event-bubbling strategy. With this strategy events fires in this order:
Event queing does not changed.
EventHandlingStrategy
Myra env now have EventHandlingStrategy property, wich default value is
Myra.Events.EventHandlingStrategy.EventCapturing, which means, behaiour is same as previously.Event-bubbling
In this RP i added option
Myra.Events.EventHandlingStrategy.EventBubbling, which changes behaviour for 'from nested to outer'. If you set env for event-bubbling:All events will be captured as usually, but will fire in 'reverse' order.
Propagation stopping
This option allows to stop fire next events (regardless of event handling strategy) and can be run from new class
MyraEventArgsfor prevent next events of the same type raise:MyraEventArgs
For ability to use
StopPropagation()only for same event type, i changedEventArgsand all its derivatives uses toMyraEventArgsandMyraEventHandler(T).This allows detect event type inside user-defined event handler (for StopPropagation) but has significant implications for existed code bases.
Tests
Tests didn't added, but all current is passed.