title: XAML- adding content to tabbed window
body: <p>I am working on an application that has been written in C#- the main display of the application has been written/ created using XAML markup in Visual Studio, and the application performs all of its current features as desired.</p>
  
  <p>My intention is to embed a web browser within the application, to allow the user to interact with a particular website from directly inside the application.</p>
  
  <p>To do this, I want to create a 'tabbed' display inside the application, where the first tab will display the application as it currently stands, and allow the user to interact with it in the same way as it currently does; the second tab will display the website to the user inside the application window, allowing the user to interact with the website in the same way they would from within a web browser.</p>
  
  <p>The xml in the <code>.xaml</code> file that is displaying the application as it currently stands is as follows:</p>
  
  <pre><code>&lt;Window x:Class="RiviamAgent.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="RIVIAM | CONNECTOR" Height="640" Width="640"
      ResizeMode="NoResize"&gt;
  
  &lt;Grid&gt;
      &lt;Menu IsMainMenu="True" Background="White"&gt;
          &lt;MenuItem Header="_View"&gt;
              &lt;MenuItem Header="_Connections"&gt;
                  &lt;MenuItem x:Name="rivMenu" Header="_RIVIAM Cloud" Click="connectorInfo"&gt;
                  &lt;/MenuItem&gt;
                  &lt;Separator /&gt;
                  &lt;MenuItem x:Name="tppMenu" Header="_TPP SystmOne" Click="connectorInfo"&gt;
                  &lt;/MenuItem&gt;
                  &lt;MenuItem x:Name="emisMenu" Header="_EMIS Web" Click="connectorInfo"&gt;
                  &lt;/MenuItem&gt;
              &lt;/MenuItem&gt;
              &lt;MenuItem Header="_Diagnostics" Click="diagMode"/&gt;
              &lt;MenuItem Header="_About" Click="About_Riviam"/&gt;
          &lt;/MenuItem&gt;
      &lt;/Menu&gt;
  
  
      &lt;Image x:Name="rivlogo" Height="128" Width="128" Margin="451,49,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Source="ic_launcher.png"/&gt;
      &lt;Image x:Name="connectedFlag" Height="30" Width="30" Margin="479,193,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Source="cloud.png"/&gt;
      &lt;Image x:Name="disconnectedFlag" Height="30" Width="30" Margin="479,193,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Source="cloud_dark.png"/&gt;
      &lt;TextBlock x:Name="unsentMsgs" Height="30" Width="30" Margin="479,193,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"  Text="!"/&gt;
  
      &lt;Image x:Name="tppFlag" Source="tppswoosh.png"  Margin="529,193,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="30" Width ="60"/&gt;
      &lt;Image x:Name="emisFlag" Source="emiswoosh.png"  Margin="529,193,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="30" Width ="60"/&gt;
  
  
      &lt;TextBlock x:Name="blah1" HorizontalAlignment="Left" Margin="41,52,0,0" TextWrapping="Wrap" Text="Select service to refer to:" VerticalAlignment="Top"/&gt;
      &lt;TextBlock x:Name="blah2" HorizontalAlignment="Left" Margin="41,89,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="56" Width="136"&gt;&lt;Run Text="Select referral document:
                                                                                                                                                             (or drag it to the logo)"/&gt;&lt;/TextBlock&gt;
      &lt;TextBlock x:Name="blahfoot" HorizontalAlignment="Left" Margin="319,10,0,0" TextWrapping="Wrap" Text="RIVIAM - Secure cloud for Health and Social Care" VerticalAlignment="Top" Height="24" Width="260"/&gt;
  
      &lt;ComboBox x:Name="serviceList" Text="pls select"  HorizontalAlignment="Left" Margin="182,49,0,0" VerticalAlignment="Top" Width="218" &gt;&lt;/ComboBox&gt;
      &lt;TextBox x:Name="fileName" Text=" " MaxLines="1" IsReadOnly="True" Margin="182,90,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"  Height="23" Width="161"/&gt;
      &lt;Button x:Name="fileBtn" Content="Browse" HorizontalAlignment="Left" Margin="348,90,0,0" VerticalAlignment="Top" Width="52" Click="fileUpload" Height="23"/&gt;
      &lt;Button x:Name="referBtn" Content="Send Referral and Patient Record" HorizontalAlignment="Left" Margin="182,150,0,0" VerticalAlignment="Top" Width="218" Click="referThis" Height="23"/&gt;
  
      &lt;TextBlock x:Name="blahfoot_Copy" HorizontalAlignment="Left" Margin="39,198,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="49" Width="361"&gt;&lt;Run FontWeight="Bold" Text="Notice"/&gt;&lt;Run Text=": "/&gt;&lt;Run Text="You must ensure that the patient has agreed to their data being shared "/&gt;&lt;Run Text="with the provider. Please contact the RIVIAM help desk on 01225 945 020 if you are unsure."/&gt;&lt;/TextBlock&gt;
  
      &lt;!-- end of normal view --&gt;
  
      &lt;ScrollViewer x:Name="scroller" HorizontalAlignment="Left" VerticalScrollBarVisibility="Auto" Margin="39,329,0,0" VerticalAlignment="Top" Height="244" Width="327"&gt;
          &lt;TextBox x:Name="infoPane" TextWrapping="Wrap" Text="nothing" IsReadOnly="True"/&gt;
      &lt;/ScrollViewer&gt;
  
      &lt;Button x:Name="f1Btn" Content="view Logs" HorizontalAlignment="Left" Margin="408,361,0,0" VerticalAlignment="Top" Width="121" Click="testFunction1"/&gt;
      &lt;Button x:Name="f2Btn" Content="delete logs" HorizontalAlignment="Left" Margin="408,393,0,0" VerticalAlignment="Top" Width="121" Click="testFunction2"/&gt;
      &lt;Button x:Name="f3Btn" Content="test function 3" HorizontalAlignment="Left" Margin="408,425,0,0" VerticalAlignment="Top" Width="121" Click="testFunction3"/&gt;
  
      &lt;Button x:Name="cntxtBtn" Content="context" HorizontalAlignment="Left" Margin="408,553,0,0" VerticalAlignment="Top" Width="121" Click="Context_Click"/&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>I am now trying to edit that XML to display two tabs- one with the application as it stands, and the second displaying a website.</p>
  
  <p>What I am unsure of though, is once I've added a <code>&lt;TabControl&gt;&lt;/TabControl&gt;</code> tag, how do I then display the current markup (for the application as it currently stands) inside a <code>&lt;TabItem&gt;&lt;/TabItem&gt;</code> tag?</p>
  
  <p>I have tried writing the following, underneath the closing <code>&lt;/Menu&gt;</code> tag:</p>
  
  <pre><code>&lt;TabControl&gt;
      &lt;TabItem Header="Application"&gt;
          ...
          Existing markup goes here...
          ...
      &lt;/TabItem&gt;
  &lt;/TabControl&gt;
  </code></pre>
  
  <p>However, when I do this, the first line of the existing markup seems fine, but the rest of it is underlined (indicating that there is a compile error). The error message that's displayed when I hover the cursor over it is </p>
  
  <blockquote>
    <p>The property 'Content' is set more than once.</p>
  </blockquote>
  
  <p>So, my question is: How do I display the normal display of my application inside one of these <code>TabItem</code>s rather than directly inside the window, as I was doing previously?</p>
  
  <p>The tutorial that I was following at <a href="http://www.wpf-tutorial.com/tabcontrol/using-the-tabcontrol/" rel="nofollow">http://www.wpf-tutorial.com/tabcontrol/using-the-tabcontrol/</a> only shows how to display simple text in the content of a <code>Tab</code>...</p>