Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVVM Access Model from View

Tags:

c#

.net

mvvm

I'm new to .net and MVVM designmodel. I'm stuck now, because in the codebehind file of one of my Views, I need to get the corresponding Model as an object. How is the relationship here? Is it possible, and is it "the right way to do it"?

like image 454
Andreas Avatar asked Nov 26 '10 16:11

Andreas


1 Answers

The View should access the ViewModel, which wraps the Model, hiding it from the View. If you need to access properties of the Model from the View, get the ViewModel to expose them as properties that the View can bind to.

like image 102
Jackson Pope Avatar answered Sep 23 '22 14:09

Jackson Pope