Data binding
Let’s explore how MVVM and data binding works in our app. We can analyze ItemDetailPage
and ItemDetailViewModel
at the beginning of our journey. The following list includes the view, viewmodel, and model that we are going to explore:
- View –
ItemDetailPage
, see Listing 3.4 in the previous chapter - Viewmodel –
ItemDetailViewModel
, see Listing 4.1 - Model –
Item
(access through interfaceIDataStore
), see Listing 3.3 in the previous chapter
ItemDetailPage
is a view used to display the content of an instance of Item
. This instance is stored in the viewmodel. The UI elements presenting the content of Item
are connected to the instance through data binding.
Data binding is used to link the properties of target and source objects. Here is a list of involved properties of target and source objects:
- Target – This is the UI element involved and this UI element has to be a child of
BindableObject
. The UI element used...