DataGrid UpdateRowEditing throws System.NullReferenceException When Column has UserSort

Apr 28, 2010 at 5:58 AM

hi,

My DataGrid has CheckBoxColumn(Editable) and TextColumn(ReadOnly).

Set CheckBoxColumnSort and Click CheckBox, and click 2nd CheckBox, UpdateRowEditing throws System.NullReferenceException.

in XAML

<data:dataGrid x:Name="MyDataGrid" Grid.Column="0" Grid.Row="0" ItemsSource="{Binding MyPtnList}"
                                               AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" RowHeaderWidth="5"
                                               HorizontalAlignment="Stretch">
            <data:DataGrid.Columns>
                      <data:DataGridCheckBoxColumn Header="check" CellStyle="{StaticResource SingleClickEditing}" Binding="{Binding IsChecked, Mode=TwoWay}"/>
                      <data:DataGridTextColumn Header="text" Binding="{Binding MyText}" Width="300" IsReadOnly="True"/>
            </data:DataGrid.Columns>
</data:dataGrid>

StackTrace

 Microsoft.Windows.Controls.DataGrid.UpdateRowEditing(DataGridCell cell)  C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataGrid\Microsoft\Windows\Controls\DataGrid.cs:行 3551
 Microsoft.Windows.Controls.DataGrid.OnExecutedCommitEdit(ExecutedRoutedEventArgs e)  C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataGrid\Microsoft\Windows\Controls\DataGrid.cs:行 2360
 Microsoft.Windows.Controls.DataGrid.OnExecutedCommitEdit(Object sender, ExecutedRoutedEventArgs e)  C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataGrid\Microsoft\Windows\Controls\DataGrid.cs:行 2245
 System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
 System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
 System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
  System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
 System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
 System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
 System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
 System.Windows.Input.RoutedCommand.Execute(Object parameter, IInputElement target)
 Microsoft.Windows.Controls.DataGrid.EndEdit(RoutedCommand command, DataGridCell cellContainer, DataGridEditingUnit editingUnit, Boolean exitEditMode) C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataGrid\Microsoft\Windows\Controls\DataGrid.cs:行 3196
 Microsoft.Windows.Controls.DataGrid.OnCurrentCellChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataGrid\Microsoft\Windows\Controls\DataGrid.cs:行 2836

・・・・

Anyone help?

thanks