Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

MVVM : Model and ViewModel

$
0
0

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

  1.       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

  1.       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,


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>