title: UserControl of UIElements in ViewModel breaks MVVM?
body: <p>We already have an existing UI for our WPF app, where separate button presses would show elements based on bindings to Visibility (MVVM), where an ICommand would set these Visibility properties on or off. These worked well, but recently we were given a requirement for a button press to show/hide elements like before, but another type of button press to show some other elements but WITHIN a TabControl. </p>
  
  <p>The way I thought to do it was to:</p>
  
  <p>a) Create separate UserControls containing those elements</p>
  
  <p>b) These UserControls are instantiated through the ViewModel during runtime depending on the button press, and bound to the View as ItemsSource through an ObservableCollection:</p>
  
  <p>ViewModel:</p>
  
  <pre><code>private ObservableCollection&lt;Object&gt; centerView;
  public ObservableCollection&lt;Object&gt; CenterView
  {
      get { return centerView; }
  
  }            
  </code></pre>
  
  <p>...</p>
  
  <pre><code>    UserControlOfReportRelatedElements reportsView = new UserControlOfReportRelatedElements();
      CenterView.Clear();
      Grid.SetRow(reportsView, 0);
      CenterView.Add(reportsView);
  </code></pre>
  
  <p>XAML:</p>
  
  <pre><code>    &lt;ItemsControl ItemsSource="{Binding CenterView}" Grid.Row="2"&gt;
          &lt;ItemsControl.ItemsPanel&gt;
              &lt;ItemsPanelTemplate&gt;
                  &lt;Grid/&gt;
              &lt;/ItemsPanelTemplate&gt;
          &lt;/ItemsControl.ItemsPanel&gt;
      &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>So depending on whether or not the UserControl is wrapped in a TabControl, we would simply slip it in the ObservableCollection (during runtime).</p>
  
  <p>This works, and it's convenient. But does this break MVVM? Is there anything else we can do?</p>