title: Inject view into TabControl using prism library
body: <p>That's how I defined <code>TabControl</code>:</p>
  
  <pre><code>&lt;TabControl ItemsSource="{Binding OpenedProjects, UpdateSourceTrigger=PropertyChanged}"
              SelectedItem="{Binding SelectedProject, Mode=OneWay}"&gt;
      &lt;!-- headers --&gt;
      &lt;!-- header definition is unimportant for this question --&gt;
  
      &lt;!-- content --&gt;
      &lt;TabControl.ContentTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;local:ProjectView /&gt;
          &lt;/DataTemplate&gt;
      &lt;/TabControl.ContentTemplate&gt;
  &lt;/TabControl&gt;
  </code></pre>
  
  <p>And these are the two methods I have defined in my Module class, that are used to register and use views:</p>
  
  <pre><code>protected override void _initializeViews() {
      _container.RegisterType&lt;MainMenuView&gt;();
      _container.RegisterType&lt;ProjectsView&gt;();
      _container.RegisterType&lt;ProjectView&gt;();
      _container.RegisterType&lt;ContentView&gt;();
  }
  
  protected override void _initializeRegions() {
      IRegion menuRegion = _regionManager.Regions[RegionNames.MainMenuRegion];
      IRegion projectsRegion = _regionManager.Regions[RegionNames.ProjectsRegion];
      IRegion contentRegion = _regionManager.Regions[RegionNames.ContentRegion];
  
      menuRegion.Add(_container.Resolve&lt;MainMenuView&gt;());
      projectsRegion.Add(_container.Resolve&lt;ProjectsView&gt;());
      contentRegion.Add(_container.Resolve&lt;ContentView&gt;());
  }
  </code></pre>
  
  <p>And the View constructor:</p>
  
  <pre><code>public ProjectView(ProjectsViewModel vm) {
      InitializeComponent();
      DataContext = vm;
  }
  </code></pre>
  
  <p>What I want to achieve is to inject <code>ProjectView</code> into <code>TabControl</code>'s content area. Obviously, currently it doesn't work because of the <code>ViewModel</code> argument in the above constructor. How can I create this functionality, the PRISM way?</p>
  
  <p>EDIT:</p>
  
  <p>I found this: <a href="https://stackoverflow.com/questions/27569383/how-to-inject-views-into-tabcontrol-using-prism">How to inject views into TabControl using Prism?</a> however if I do the same as the author of that question, I'm getting:</p>
  
  <p><code>System.InvalidOperationException: ItemsControl's ItemsSource property is not empty.</code></p>