title: Binding ViewModel  to ContentControl as its DataContext
body: <p>I want to change UserControls on button clicks (I'm not going to complicate here, so I'll only mention important parts). So idea was to bind ViewModels of those UserControls to ContentControl, and than associate them Views using DataTemplates.
  Here's the code:</p>
  
  <pre><code>&lt;Window x:Class="Project.MainWindow"&gt;
  &lt;Window.Resources&gt;
      &lt;DataTemplate DataType="{x:Type UserControl:ViewUserControlViewModel}" &gt;
          &lt;UserControl:ViewUserControl/&gt;
      &lt;/DataTemplate&gt;
      &lt;DataTemplate DataType="{x:Type UserControl:EditUserControlViewModel}" &gt;
          &lt;UserControl:EditUserControl/&gt;
      &lt;/DataTemplate&gt;
  &lt;/Window.Resources&gt;
  &lt;Grid&gt;
      &lt;ContentControl DataContext="{Binding UserControlViewModel}" /&gt;
      &lt;Button Content="View" Click="ChangeToView()"/&gt;
      &lt;Button Content="Edit" Click="ChangeToEdit()"/&gt;
  &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>ViewModel:</p>
  
  <pre><code>public class MainWindowViewModel : DependencyObject
  {
      public DependencyObject UserControlViewModel
      {
          get { return (DependencyObject)GetValue(UserControlViewModelProperty); }
          set { SetValue(UserControlViewModelProperty, value); }
      }
      public static readonly DependencyProperty UserControlViewModelProperty = 
             DependencyProperty.Register("UserControlViewModel", typeof(DependencyObject), typeof(MainWindowViewModel), new PropertyMetadata());
  
      public MainWindowViewModel()
      {
          UserControlViewModel = new EditUserControlViewModel();
      }
  }
  </code></pre>
  
  <p>But theres a problem. When I start project, I only see buttons but not any UserControls. What did I do wrong?</p>