Add two way binding for check button state #8
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.
This PR introduces two way binding between view and view-model state for check-box button style controls in the package, i.e. in this case the
Checked
property. In general the same pattern will be followed for all other controls with state.Almost all primitive controls are concerned with managing a single piece of state, and we want any changes in this state to be propagated as an observable sequence. To allow two way binding we replaced the UI change event source with a
BehaviorSubject
that is responsible for storing the state. Apart from signaling all changes, this subject can also be used as a binding source by the UI control, so that any external changes to the state are automatically reflected in the UI. Finally, the state is exposed through a configurable property which can be externalized in the workflow.Aside from two way binding, this allows for state to persist between opening and closing of visualizer windows, and also for dynamically changing the state using other workflow inputs by externalizing and mapping the state property.