title: C# WPF Label Visibility Exception
body: <p>I'm trying to show a label based on the selected value of a combo box. I'm using VS2010.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>private void pointsSettings_SelectionChanged(object sender, SelectionChangedEventArgs e)
      {
          if (this.pointsSettings.SelectedValue.ToString() == "between")
          {
             pointsAboveLabel.Visibility = Visibility.Collapsed;
          }
          else
          {
             pointsAboveLabel.Visibility = Visibility.Visible;
          }
      }
  </code></pre>
  
  <p>And the XAML:</p>
  
  <pre><code> &lt;ComboBox Name="pointsSettings" SelectionChanged="pointsSettings_SelectionChanged"&gt;
       &lt;ComboBoxItem Content="between" /&gt;
       &lt;ComboBoxItem Content="above" IsSelected="True" /&gt;
       &lt;ComboBoxItem Content="below" /&gt;
   &lt;/ComboBox&gt;
   &lt;Label Content="points" Name="pointsAboveLabel" /&gt;
   &lt;Label Content="and" Name="pointsBetweenLabel" Visibility="Collapsed" /&gt;
  </code></pre>
  
  <p>And here is the error I got: 
  <img src="https://i.stack.imgur.com/V0tqo.png" alt="enter image description here">
  Text reads: <em>"Object reference not set to an instance of an object"</em>. </p>
  
  <p>I'm aware that there is another question very similar this - with the same error in fact- however the solution provided (moving a variable initialization to above the InitializeComponent() method call) is not appropriate for me as I have no object initialization.</p>
  
  <p>Any and all help is appreciated most warmly.</p>