How do you pass complex types to constructors, with the MVVM pattern and IoC? And how would you navigate to the new view?
Below is a simplified model which shows what I want to do.
class Weekday {
List<Grocery> groceries;
}
class Grocery {
string name;
}
class WeekdaysVm {
List<Weekday> weekdays;
public WeekdaysVm(IService service) { ... }
}
class GroceriesVm {
public GroceriesVm(IService service, List<Grocery> groceries) {
...
}
List<Grocery> groceries;
}
Say I am in the WeekdaysView and press a weekday. Now I want to navigate to the GroceryView with the weekday.Groceries passed to the GroceriesVm. How would I do this with MVVM and IoC?
Please imagine the setting being vastly more complex, with ~20 views navigating all over the place.