Define binding mode and update trigger
Define binding modes and update triggers to configure how changes are replicated between the data source and the UI.
Read time 2 minutesLast updated a month ago
To define how changes are replicated between the data source and the UI, you can set the binding mode and update triggers for a binding object. You can set the binding mode and update triggers in UI Builder, UXML, or C#.
Define binding modes
Binding modes configure how changes are replicated between the data source and the UI. The following binding modes are available:
- TwoWay: Changes are replicated from the data source to the UI and from the UI to the data source. This is the default binding mode.
- ToTarget: Changes are replicated from the data source to the UI only.
- ToSource: Changes are replicated from the UI to the data source only.
- ToTargetOnce: Changes are replicated from the data source to the UI only once, unless it's marked as dirty.
Define update triggers
You can update binding objects on every frame or when a change occurs in the data source. The following update triggers are available:
- Every frame
- On change detection or every frame if change detection is impossible. Refer to Define data sources for more details.
- When explicitly marked as
dirty
To define update triggers, use the following properties:
- : Sets the binding object as
MarkDirty, so that it gets updated during the next cycle.dirty - : Updates a binding object on every frame, regardless of the data source version.
updateTrigger