title: WPF Combobox not showing selected item on after window loads
body: <p>I have a Combobox in a WPF application containing three items, that allows a user to switch languages.</p>
  
  <pre><code>&lt;ComboBox x:Name="cmbSelectLanguage" Margin="81,53,0,0" SelectionChanged="cmbSelectLanguage_SelectionChanged" TabIndex="1" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" SelectedIndex="0"&gt;
          &lt;ComboBoxItem Name="enUS"&gt;                
                  &lt;TextBlock Text="English - US"/&gt;                
          &lt;/ComboBoxItem&gt;
          &lt;ComboBoxItem Name="enGB"&gt;                       
                  &lt;TextBlock Text="English - UK"/&gt;              
          &lt;/ComboBoxItem&gt;           
          &lt;ComboBoxItem Name="elGR"&gt;                   
                  &lt;TextBlock Text="Greek"/&gt;              
          &lt;/ComboBoxItem&gt;
  &lt;/ComboBox&gt;
  </code></pre>
  
  <p>The problem is, that when the window initially loads, it won't display the default value. It shows nothing, like this: </p>
  
  <p><img src="https://i.imgur.com/WBRiou0.png" alt="First Image"></p>
  
  <p>As soon as I move the mouse over the Combobox or over the button to the bottom right, then the default item appears, like this:</p>
  
  <p><img src="https://i.imgur.com/PaYlshf.png" alt="Second Image"></p>
  
  <p>I tried to set the Combobox SelectedIndex through both XAML and the code-behind after the Window loads, but nothing seems to work.</p>
  
  <p>What could possibly cause this behavior and how would I go about fixing it?</p>
  
  <p><strong>EDIT:</strong> Thanks for your responses. I found the solution by chance. After removing lots of XAML and some code-behind code I noticed that the problem was gone after deleting this from my Window XAML definition:
  <strong>SizeToContent="WidthAndHeight"</strong></p>
  
  <p>All my other code is exactly the same, this is the only thing I had to change after all. Even though I don't have a clue as to why, it works :)</p>