title: What is the best way to switch views/usercontrols in MVVM-light and WPF?
body: <p>I'm relatively new to WPF and MVVM and the hardest thing I have found is how to simply switch a usercontrol or a view in an application.</p>
  
  <p>In winforms, to have a control remove itself you would simple say                                        this.Parent.Controls.Remove(this);</p>
  
  <p>In WPF there is no generic Parent control, you would have to typecast it to the specific type (i.e. Grid) and then remove it. </p>
  
  <p>This also seems to break the MVVM architecture. I have also tried data templates and content presenters, which work well, except for the fact that I can't change the datacontext from code, since the datacontext is always the viewmodellocator. </p>
  
  <p>Are pages the acceptable way to do this in WPF now?  What if I had a grid with a custom usecontrol and I wanted to switch it based on some variable in the viewModel?  It seems like the simplest tasks cannot be accomplished easily in WPF.</p>