What is the best practice to load an UserControl into an Window with MVVM-Light?
Where create the UserControl instance, in the ViewModel from Window or direct in the window?
What is the best practice to load an UserControl into an Window with MVVM-Light?
Share
Your VM should not contain any UI specific code like controls if you are worried about best practice. For example, if you have a property in the VM that controls the visibility of a control in your view, that property should be of type bool and not Visibility. The view will use the bool property to hide or show the control.
So you have a view (like a window) which databinds against a VM. Some property changes in the VM which will cause some code in the window to create and show a user control.