Data Layer
I have an Order class as an entity. This Order entity is my model object.
Order can be different types, let it be
A
B
C
D
Also Order class may have common properties like Name, Time of creation, etc.
Also based on the order type there are different fields that are not common.
View Layer
The view contains the following
- Main Menu
- ListView
The Main Menu contains the drop down menu button which is used to create the order based on the type selected from the drop down. The drop down contains the Order types ( A ,B , C and D).
There are different user control based on the order type. Like for example if user chooses to create an order of type A then different view with different inputs field is popped up.
Hence, there are four user control for each order type.
If user selects A option from the drop down then Order of type A is created and vica versa.
Now below is the List View that contains the List of orders so far created by the user.
To Edit any particular order user may double click the list view row. Based on the order type clicked by the user in the listview, the view of that order type opens in edit mode. For example if user selects an order type A from the list view then view for order type A open in edit mode.
Please suggest an interaction model for view models in the scenario discussed above.
Please excuse me if the query is very basic, since I am new new to MVVM and WPF.
Rather than give you a specific design, I'm going to suggest a different way of looking at the problem.
Make your xaml. Now, if it could have the data organized in any way exposing any set of methods it wanted, what would that look like? Don't even think about the real structure of the entities when imagining this. More inheritance? Less? Up to you - whatever would be best for your View.
Okay, whatever you just described is your ViewModel. Write the public API for that. Then, hook it up to the actual underlying entities.