Navigation and MVVM
One of the key purposes of the MVVM pattern is to isolate an app's presentation layer from its other layers; in doing so, an app's business logic is also isolated. One of the thoughts behind this isolation is to have a user interface that is only concerned with displaying data and that is completely independent of how that data is stored, acquired, manipulated, or shared with the rest of the app. As explained in Chapter 2, MVVM and DataBinding, this is typically accomplished through databinding. In MVVM, the actions that a user takes on a page are bound to commands on that page's backing ViewModel. It is very common for actions to result in a transition to another page—either by directly linking to it or by automatically navigating to a previous page after performing a task, such as saving data. Because of this, it makes sense to rethink how we do navigation in an app that leverages the MVVM pattern so that it can be controlled by ViewModels and...