Two-way binding causes changes to either the source value or the target value to automatically update the other. More...
#include <kanzi/core.ui/binding/two_way_binding.hpp>
Static Public Member Functions | |
static TwoWayBindingSharedPtr | create (BindingSourcePtr source) |
Creates a two-way binding. More... | |
static TwoWayBindingSharedPtr | create (string_view sourcePath, AbstractPropertyType sourcePropertyType, PropertyField sourceField) |
Creates a two-way binding. More... | |
static TwoWayBindingSharedPtr | create (string_view sourcePath, AbstractPropertyType sourcePropertyType) |
Creates a two-way binding. More... | |
Protected Member Functions | |
void | addReverseProcessorOverride (BindingProcessorSharedPtr processor) override |
AbstractBinding::addReverseBindingProcessorOverride implementation. More... | |
BindingProcessorConstIterator | beginReverseProcessorsOverride () const override |
Gets an iterator to the beginning of reverse binding processors. More... | |
AbstractBindingRuntimeSharedPtr | createRuntimeOverride (AbstractBindingSharedPtr binding, BindingLookupContextPtr sourceLookupContext, BindingTargetRuntimePtr targetRuntime) override |
AbstractBinding::createRuntime() implementation. More... | |
BindingProcessorConstIterator | endReverseProcessorsOverride () const override |
Gets an iterator to the end of reverse binding processors. More... | |
void | removeReverseProcessorOverride (BindingProcessor &processor) override |
AbstractBinding::removeReverseBindingProcessorOverride implementation. More... | |
TwoWayBinding (BindingSourcePtr source) | |
Constructor. More... | |
Protected Member Functions inherited from kanzi::AbstractBinding | |
AbstractBinding (BindingSourcePtr source) | |
Constructor. More... | |
Protected Attributes | |
BindingProcessorContainer | m_reverseProcessors |
Binding processors (reverse direction). More... | |
Protected Attributes inherited from kanzi::AbstractBinding | |
bool | m_createdFromKZB |
Is the binding sourced from a KZB? This field is used to determine if the binding should be removed during patching. More... | |
BindingProcessorContainer | m_processors |
Binding processor (forward direction). More... | |
BindingSourcePtr | m_source |
Binding source. More... | |
Additional Inherited Members | |
Public Types inherited from kanzi::AbstractBinding | |
typedef BindingProcessorContainer::const_iterator | BindingProcessorConstIterator |
Binding processor iterator type. More... | |
typedef vector< BindingProcessorSharedPtr > | BindingProcessorContainer |
Binding processor container type. More... | |
Public Member Functions inherited from kanzi::AbstractBinding | |
void | addProcessor (BindingProcessorSharedPtr processor) |
Add a binding processor. More... | |
void | addReverseProcessor (BindingProcessorSharedPtr processor) |
Add a binding processor (reverse direction). More... | |
BindingProcessorConstIterator | beginProcessors () const |
Gets an iterator to the beginning of binding processors. More... | |
BindingProcessorConstIterator | beginReverseProcessors () const |
Gets an iterator to the beginning of reverse direction binding processors. More... | |
AbstractBindingRuntimeSharedPtr | createRuntime (AbstractBindingSharedPtr binding, BindingLookupContextPtr sourceLookupContext, BindingTargetRuntimePtr targetRuntime) |
Creates a binding runtime for this binding. More... | |
BindingProcessorConstIterator | endProcessors () const |
Gets an iterator to the end of binding processors. More... | |
BindingProcessorConstIterator | endReverseProcessors () const |
Gets an iterator to the end of reverse direction binding processors. More... | |
BindingSource * | getSource () |
Gets the binding source for this binding. More... | |
bool | isCreatedFromKZB () const |
Indicates whether the binding is sourced from a KZB? Used to check whether or not to remove the binding during patching. More... | |
void | removeProcessor (BindingProcessor &processor) |
Remove a binding processor. More... | |
void | removeReverseProcessor (BindingProcessor &processor) |
Remove a binding processor (reverse direction). More... | |
void | setCreatedFromKZB (bool flag) |
Sets the created from KZB flag. More... | |
virtual | ~AbstractBinding ()=default |
Destructor. More... | |
Two-way binding causes changes to either the source value or the target value to automatically update the other.
In a two-way binding the binding from the source to target works the same way as in a Binding. When the source value is modified, the value is written to the BindingTargetRuntime of the TwoWayBinding.
When anything other than the binding itself modifies the target value, the value is copied to the source. The value is copied to the source using setProperty() to write the property value.
Removing the binding does not erase the value that is written to the source.
|
inlineexplicitprotected |
Constructor.
source | Binding source owned by this binding. |
|
static |
|
static |
Creates a two-way binding.
sourcePath | Path to source object. |
sourcePropertyType | Source property type from which to bind. |
sourceField | Field of the source property type from which to bind. Use PropertyFieldWhole to bind to the whole property. |
|
inlinestatic |
Creates a two-way binding.
Whole property field is used.
sourcePath | Path to source object. |
sourcePropertyType | Source property type from which to bind. |
|
overrideprotectedvirtual |
AbstractBinding::createRuntime() implementation.
Implements kanzi::AbstractBinding.
|
inlineoverrideprotectedvirtual |
AbstractBinding::addReverseBindingProcessorOverride implementation.
Reimplemented from kanzi::AbstractBinding.
|
inlineoverrideprotectedvirtual |
AbstractBinding::removeReverseBindingProcessorOverride implementation.
Reimplemented from kanzi::AbstractBinding.
|
inlineoverrideprotectedvirtual |
Gets an iterator to the beginning of reverse binding processors.
Reimplemented from kanzi::AbstractBinding.
|
inlineoverrideprotectedvirtual |
Gets an iterator to the end of reverse binding processors.
Reimplemented from kanzi::AbstractBinding.
|
protected |
Binding processors (reverse direction).