Binding data to widgets
When we explored widgets in Chapter 5, Widget Library and Themes, we saw how information can be gathered and presented. Each widget we looked at was configured manually, and accessing data that the user entered (such as with the Entry
widget) required code to query the widget's state. The fyne.io/fyne/v2/data/binding
package provides functionality that supports automatically connecting widgets to data sources to handle this more efficiently.
In the following sections, we will explore what data binding is, why it is so useful, and how it is designed within the Fyne APIs.
Understanding data binding
There are many different approaches to data binding, and definitions can vary, depending on the toolkit that you are working with. In general, data binding allows the component of a graphical interface to have its display controlled by a separate data source. Moreover, it ensures that the graphical representation is always up to date with changes, and...