I am rather new in WPF and I am developing a WPF application in VB.net. I have several controls in my Main Window. As I follow the MVVM pattern, I have a MainViewModel
for my Main Window. In this ViewModel, I instatiate my user control view models.
Public Class MainViewModel
Public Property myUserControlViewModel As UserControlViewModel
Public Sub New()
Dim myModel As Model
myModel = New Model(parameter)
myUserControlViewModel = New myUserControlViewModel (myModel)
End Sub
End Class
Question1: Is this pattern following MVVM Correctly?
Question2: How can I force my user control to use myUserControlViewModel
? I mean specificly this instance which is already created in my MainViewModel
. How should I even introduce myUserControlViewModel
to my User Control?