Can someone please enlighten me with MVVM
My initial understanding was I create a list of model objects but now I find out that I have to create an object of the viewmodel that i will bind to view.
Here is the structure of my project
- 2 other ViewModels
In the StudentModel I have
publicList<StudentModel> GetAllMessageField()
{
st.Add(newStudentModel ("","", 5, 4));
st.Add(newStudentModel ("","", 9, 7));
return st;
}
And the same in my other model
- In my StudentViewModel
I want to create a collection of StudentViewModel that I can bind to grid.
publicObservableCollection<StudentViewModel> GetAllStudents()
{
List comes here
returnstudentViewModel
}
I can create a list from studentModel and bind it but that is not the intention to MVVM.
I want my view to strictly connect to objects of StudentViewModel
Thank you,