title: Tab control selecting first tab by default
body: <p>I am not sure if this is just the default WPF tab control behaviour or if there is a way to disable it.</p>
  
  <p>I have a tab control defined as below:</p>
  
  <pre><code>&lt;TabControl TabStripPlacement="Left"
              Background="Transparent" 
              ItemsSource="{Binding Path=AvailableProducts}"
              SelectedValuePath="Name"
              SelectedValue="{Binding Path=SelectedProduct, Mode=TwoWay}"&gt;
  </code></pre>
  
  <p>AvailableProducts is a list of products. For example:</p>
  
  <pre><code>Foo
  Bar
  Baz
  </code></pre>
  
  <p>Initially, SelectedProduct is <strong>null</strong> but when the tab control is displayed, it has automatically selected <strong>Foo</strong>.  What I want is for no tab to be selected at all.</p>
  
  <p>Will the tab control always select the first tab?</p>
  
  <p><strong>UPDATE</strong>  </p>
  
  <p>I added some sample code that shows what I am describing.</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" Height="350" Width="525"&gt;
      &lt;Grid&gt;
          &lt;TabControl SelectedIndex="1"&gt;
              &lt;TabItem Header="TAB 1"&gt;
                  &lt;Button&gt;TEST&lt;/Button&gt;
              &lt;/TabItem&gt;
              &lt;TabItem Header="TAB 2"&gt;
                  &lt;TabControl TabStripPlacement="Left"
                              Background="Transparent" 
                              ItemsSource="{Binding Path=AvailableProducts}"
                              SelectedValuePath="Name"
                              SelectedValue="{Binding Path=SelectedProduct, Mode=TwoWay}"/&gt;
              &lt;/TabItem&gt;
          &lt;/TabControl&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  
  
  
  
  using System.Collections.Generic;
  
  namespace WpfApplication1
  {
      public partial class MainWindow
      {
          private List&lt;Product&gt; _availableProducts = new List&lt;Product&gt;();
  
          public MainWindow()
          {
              SelectedProduct = null;
              InitializeComponent();
              _availableProducts.Add(new Product("Foo"));
              _availableProducts.Add(new Product("Bar"));
              _availableProducts.Add(new Product("Baz"));
  
              DataContext = this;
          }
  
          public List&lt;Product&gt; AvailableProducts
          {
              get
              {
                  return _availableProducts;
              }
          }
  
          public string SelectedProduct { get; set; }
      }
  
      public class Product
      {
          public Product(string name)
          {
              Name = name;
          }
  
          public string Name { get; set; }
  
          public override string ToString()
          {
              return Name;
          }
      }
  }
  </code></pre>
  
  <p>If you run the code above, the app starts with "TAB 2" displayed and none of the tabs Foo/Bar/Baz are selected.  However, if you change</p>
  
  <pre><code>&lt;TabControl SelectedIndex="1"&gt;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>&lt;TabControl SelectedIndex="0"&gt;
  </code></pre>
  
  <p>and run the app, it starts on "TAB 1" and when you switch to "TAB 2", the first tab is selected (Foo).</p>
  
  <p>I don't understand why if you start on "TAB 2" it works as I expect but if you start on "TAB 1" and then switch to "TAB 2" a tab gets selected by default.</p>