MVVM: Do I need Inheritance with ViewModels A + B ?
- by Lisa
Hello guys my first post on SO because EE sucks in the meantime ;P
I am using wpf and mvvm in my desktop application.
Scenario:
I have a calendar with week A and week B which are rotating by every X week depending on the user settings. But the UserControl "week B" is only visible when the user sets the option "rotating weeks"...
The UserControl with week A has a DataGrid and for week B I want to use the same UserControl of course.
What I want to achieve is that all data entered/choosen by the user in the Week A is saved/backed by a ViewModel A and Model C. When the user wants a rotating weekly calendar plan I need also a ViewModel B and again Model C.
The reason why I need to know what data entered by the user belongs to week A or week B is because I have to write the entered data in a certain order into the database = db.Write(weekA),db.Write(weekB),db.Write(weekA),etc...
I am unsure how a solution could look like...
What would you do to identify a ViewModel A or B so you know the order of how to write the data in the proper order into database?
Any other suggestions are also welcome of course, maybe I think in the wrong direction its late here :)
I am new to mvvm so please be patient.