MVVM View reference to ViewModel

Posted by BrettRobi on Stack Overflow See other posts from Stack Overflow or by BrettRobi
Published on 2010-03-29T16:30:36Z Indexed on 2010/03/29 16:33 UTC
Read the original article Hit count: 268

Filed under:

I'm using MVVM in a WPF app. I'm very new to both. Let me state that I am not a purest in the MVVM pattern, I am trying to use as many best practices as I can but am trying to make what I think are reasonable compromises to make it work in our environment. For example, I am not trying to achieve 0% code in my View codebehind.

I have a couple of questions about best practices.

1) I understand I don't want my VM to know about the attached View, but is it reasonable for the View to have a reference to its VM?

2) If a control in a View opens another View (such as a dialog) should I handle this in the View? It seems wrong to handle it in the VM since then the VM has some knowledge of a specific View.

© Stack Overflow or respective owner

Related posts about mvvm