|
UsoUIElements 0.1.0
Data Centric implimentation of Unity's UI Elements (UI Toolkit)
|
Data binding allows you to bind a property in a data source object to a property in a target object. In the standard UI Elements package this is done by:
While this is simple, it can be a little verbose and VERY repetitive as you must do all these steps for every element.
In UsoUIElements we have built this (and several other repetitive tasks) into constructor methods for evey field so that data binding can be done at creation time or later in a loop if needed.
All elements support data binding and can be setup at creation time and will apply the default bindpath.
All elements have the same signiture structure for simplicity
When binding AFTER creation you can use the ApplyBinding() method to bind to any available property in the element.
There are also several other constructors for each of the elements that allow adding text, or other related elements settings, but the one shown above is the most basic way of creating and binding the element at creation time.
For details on available Contructors see the documentation for the element type.
Using a UsoLabel as an example:
The code above would bind the default bind property (for a label it is the .text property) to a property in the data source object named "exampleBindingPath" in READ ONLY mode.
Valid Binding Modes are: