Adding event handler causes load time NullPointer

Jul 6, 2010 at 7:27 PM

Hi,

I've defined a column in my grid as follows:

 

<tk:DataGridTemplateColumn Header="Inspect">
 <tk:DataGridTemplateColumn.CellTemplate>
  <DataTemplate>
   <Button Click="OnPlayClick">
    <Image Height="15" Source="../Icons/play-icon.png" />
   </Button>
  </DataTemplate>
 </tk:DataGridTemplateColumn.CellTemplate>
</tk:DataGridTemplateColumn>

 

When the XAML is loaded, the following NullPointer is thrown:

C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataGrid\Microsoft\Windows\Controls\Primitives\DataGridRowsPresenter.cs:line 109       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)

This error does not occur when I remove the event handler attribute.

Furthermore, it seems to be triggered by adding a handler to any type of event, not just the Click event.

Am I maybe overlooking something obvious here?

TIA,

Ben