Reproduction sample for the following discussion:
To see the behavior:
- Put breakpoint in constructor of both BarViewModel and FooViewModel
- Run the sample
- Press the "Show Foo" button, FooViewModel is constructed and FooView is displayed
- Press the "Show Bar" button, BarViewModel is constructed, then a FooViewModel is contructed and then BarView is displayed.
Why is a FooViewModel constructed at step 4 and how can it be prevented from happening.