title: nullReferenceException adding object to grid
body: <p>whenever I try to add a tileSlider to a grid, an NRE is caused. I can't explain why, hopefully someone of you can help me with that.</p>
  
  <p>EDIT2:
  tileSlider is a custom control provided here: <a href="http://tileslider.codeplex.com/" rel="nofollow">http://tileslider.codeplex.com/</a>
  I tried to use it in my app and failed to implement it in c#-code behind.</p>
  
  <p>code:</p>
  
  <pre><code>    private void addNormalTiles()
      {
          foreach (KeyValuePair&lt;TileSlider, int[]&gt; slider in (App.Current as App).normalTiles)
          {
              TileSlider x = slider.Key;
              x.Size = 228;
              Grid.SetColumnSpan(x, 2);
              Grid.SetRowSpan(x, 2);
              Grid.SetRow(x, slider.Value[0]);
              Grid.SetColumn(x, slider.Value[1]);
              ContentPanel.Children.Add(x);
          }
      }
  </code></pre>
  
  <p>thanks</p>
  
  <p>EDIT:</p>
  
  <pre><code>   System.NullReferenceException wurde nicht behandelt. 
     Message=NullReferenceException StackTrace: at     
     ScottIsAFool.Controls.TileSlider.TileSlider_Loaded(Object sender, RoutedEventArgs e)
     at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate       
     handlerDelegate, Object sender, Object args)
     at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs,
     Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName) 
  </code></pre>