title: why im getting exception ('System.NullReferenceException') in ComboBox
body: <p>if i add an eventhandler  to combobox ,SelectionChanged for examle, im getting an exception. can anybody tell me why.</p>
  
  <p>strange behavior, because on installed win7 with VS2010 on my Laptop it runs successfully.</p>
  
  <p>the Exception:</p>
  
  <pre><code>A first chance exception of type 'System.NullReferenceException' occurred in    wpfapplication.exe
  Additional information: Object reference not set to an instance of an object.
  </code></pre>
  
  <p>exception callstack:</p>
  
  <blockquote>
    <p>PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadTemplateXaml(System.Xaml.XamlReader templateReader, System.Xaml.XamlObjectWriter currentWriter) + 0x247 bytes<br>
        PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadTemplateXaml(System.Xaml.XamlObjectWriter objectWriter) + 0x66 bytes 
        PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(System.Windows.DependencyObject container, System.Windows.Markup.IComponentConnector componentConnector, System.Windows.Markup.IStyleConnector styleConnector, System.Collections.Generic.List affectedChildren, System.Windows.UncommonField templatedNonFeChildrenField) + 0x26a bytes 
        PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadContent(System.Windows.DependencyObject container, System.Collections.Generic.List affectedChildren) + 0x76 bytes<br>
        PresentationFramework.dll!System.Windows.StyleHelper.ApplyTemplateContent(System.Windows.UncommonField dataField, System.Windows.DependencyObject container, System.Windows.FrameworkElementFactory templateRoot, int lastChildIndex, System.Collections.Specialized.HybridDictionary childIndexFromChildID, System.Windows.FrameworkTemplate frameworkTemplate) + 0xc4 bytes<br>
        PresentationFramework.dll!System.Windows.FrameworkTemplate.ApplyTemplateContent(System.Windows.UncommonField templateDataField, System.Windows.FrameworkElement container) + 0x3b bytes<br>
        PresentationFramework.dll!System.Windows.FrameworkElement.ApplyTemplate() + 0x7b bytes<br>
        PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x40 bytes<br>
        PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x207 bytes  </p>
  </blockquote>
  
  <p>Xaml:</p>
  
  <pre><code>&lt;DataGrid Margin="80,0,0,0"  GridLinesVisibility="None"  
                                                RowDetailsVisibilityMode="Collapsed" 
                                                ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}"  
                                                RowStyle="{StaticResource DataGridRowStyleAlternation}" 
                                                AutoGenerateColumns="False" SelectionMode="Single" 
                                                AlternationCount="2" Background="Transparent" HeadersVisibility="Column" 
                                                x:Name="detailsDatagrid" 
                                                Initialized="scenesDetailsDataGrid_Initialized"
                                                ItemsSource="{Binding Source={StaticResource scenesRequisitesViewSource}}" 
                                                ColumnDisplayIndexChanged="detailsDatagrid_ColumnDisplayIndexChanged" &gt;
                                          &lt;DataGrid.Columns&gt;
                                              &lt;DataGridTemplateColumn Header="Fahrzeug" Width="SizeToCells"&gt;
  
                                                  &lt;DataGridTemplateColumn.CellTemplate&gt;
                                                      &lt;DataTemplate&gt;
                                                          &lt;ComboBox DisplayMemberPath="Name"
                                                                     ItemsSource="{Binding Path=ProjectsRequisites, Source={StaticResource projectsViewSource}, UpdateSourceTrigger=PropertyChanged}" 
                                                                     SelectedValue="{Binding Path=RequisiteId,Mode=TwoWay}"
                                                                     SelectedValuePath="ID"     
                                                                    SelectionChanged="ComboboxRequisite_SelectionChanged"
                                                                     Tag="{Binding}" /&gt;
  
                                                      &lt;/DataTemplate&gt;
                                                  &lt;/DataGridTemplateColumn.CellTemplate&gt;
                                              &lt;/DataGridTemplateColumn&gt;
                                              &lt;DataGridTextColumn IsReadOnly="True"  Binding="{Binding Path=Costs,StringFormat={}{0:C}, ConverterCulture={x:Static gl:CultureInfo.CurrentCulture}}" Header="Kosten" Width="SizeToCells" /&gt;
                                              &lt;DataGridTextColumn Binding="{Binding Path=Count}" Header="Anzahl" Width="SizeToHeader" /&gt;
                                          &lt;/DataGrid.Columns&gt;
                                      &lt;/DataGrid&gt;
  </code></pre>