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. | |
static TwoWayBindingSharedPtr | create (string_view sourcePath, AbstractPropertyType sourcePropertyType) |
Creates a two-way binding. | |
static TwoWayBindingSharedPtr | create (string_view sourcePath, AbstractPropertyType sourcePropertyType, PropertyField sourceField) |
Creates a two-way binding. | |
Protected Attributes | |
BindingProcessorContainer | m_reverseProcessors |
Binding processors (reverse direction). | |
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. | |
BindingProcessorContainer | m_processors |
Binding processor (forward direction). | |
BindingSourcePtr | m_source |
Binding source. | |
Additional Inherited Members | |
Public Types inherited from kanzi::AbstractBinding | |
using | BindingProcessorConstIterator |
Binding processor iterator type. | |
using | BindingProcessorContainer |
Binding processor container type. | |
Public Member Functions inherited from kanzi::AbstractBinding | |
void | addProcessor (BindingProcessorSharedPtr processor) |
Add a binding processor. | |
void | addReverseProcessor (BindingProcessorSharedPtr processor) |
Add a binding processor (reverse direction). | |
BindingProcessorConstIterator | beginProcessors () const |
Gets an iterator to the beginning of binding processors. | |
BindingProcessorConstIterator | beginReverseProcessors () const |
Gets an iterator to the beginning of reverse direction binding processors. | |
AbstractBindingRuntimeSharedPtr | createRuntime (AbstractBindingSharedPtr binding, BindingLookupContextPtr sourceLookupContext, BindingTargetRuntimePtr targetRuntime) |
Creates a binding runtime for this binding. | |
BindingProcessorConstIterator | endProcessors () const |
Gets an iterator to the end of binding processors. | |
BindingProcessorConstIterator | endReverseProcessors () const |
Gets an iterator to the end of reverse direction binding processors. | |
BindingSource * | getSource () |
Gets the binding source for this binding. | |
bool | isCreatedFromKZB () const |
Indicates whether the binding is sourced from a KZB? Used to check whether or not to remove the binding during patching. | |
void | removeProcessor (BindingProcessor &processor) |
Remove a binding processor. | |
void | removeReverseProcessor (BindingProcessor &processor) |
Remove a binding processor (reverse direction). | |
void | setCreatedFromKZB (bool flag) |
Sets the created from KZB flag. | |
virtual | ~AbstractBinding ()=default |
Destructor. | |
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.
|
overrideprotectedvirtual |
AbstractBinding::addReverseBindingProcessorOverride() implementation.
Reimplemented from kanzi::AbstractBinding.
|
overrideprotectedvirtual |
AbstractBinding::removeReverseBindingProcessorOverride() implementation.
Reimplemented from kanzi::AbstractBinding.
|
overrideprotectedvirtual |
AbstractBinding::beginReverseProcessorsOverride() implementation.
Reimplemented from kanzi::AbstractBinding.
|
overrideprotectedvirtual |
AbstractBinding::endReverseProcessorsOverride() implementation.
Reimplemented from kanzi::AbstractBinding.
|
protected |
Binding processors (reverse direction).