Added event handling settings and event-bubbling strategy #490
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.