title: Assign tab content in WPF to a page
body: <p>I am trying to add dynamic tabs to my application. Right now if I click a button, it will open a new page. What I want is to open this page in a new tab. But when I set up the tab content to a page , the code complains. I wanna do something like this</p>
  <pre><code>private void bttnGoToClientsOnClick(object sender, RoutedEventArgs e)
  {
      var content = new TextBlock();
      TabItem tab = new TabItem();
      tab.Header = &quot;Search Page&quot;;
      SearchPage sp = new SearchPage();
      tab.Content = sp;
      tabControl.Items.Add(tab);
      this.NavigationService.Navigate(sp);
  }
  </code></pre>
  <p>is there any way I can convert my page to usercontrol or cast it as user control</p>
  <p>Thank you!</p>