整数プロパティにバインドされたTextColumnを使用するDatagridがあります。列ヘッダーをクリックするまで、TextColumnの値をすべて編集できます。クリックすると列は正しく並べ替えられますが、後で値を編集しようとすると、別の場所をクリックしてLostFocusイベントが発生したときに例外が発生します。
(質問は、再現可能にするために必要最小限の設定に変更されました)
XAML:
<DataGridTextColumn Binding="{Binding CompStrength}"/>
StackTrace:
bij System.Windows.Controls.DataGrid.UpdateRowEditing(DataGridCell cell)
bij System.Windows.Controls.DataGrid.OnExecutedCommitEdit(ExecutedRoutedEventArgs e)
bij System.Windows.Controls.DataGrid.OnExecutedCommitEdit(Object sender, ExecutedRoutedEventArgs e)
bij System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
bij System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
bij System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
bij System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
bij System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
bij System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
bij System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
bij System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
bij System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
bij System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
bij System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
bij System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
bij System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
bij System.Windows.Input.RoutedCommand.Execute(Object parameter, IInputElement target)
bij System.Windows.Controls.DataGrid.EndEdit(RoutedCommand command, DataGridCell cellContainer, DataGridEditingUnit editingUnit, Boolean exitEditMode)
bij System.Windows.Controls.DataGrid.OnCurrentCellChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
bij System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
bij System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
bij System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
bij System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
bij System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
bij System.Windows.DependencyObject.SetCurrentValueInternal(DependencyProperty dp, Object value)
bij System.Windows.Controls.DataGrid.set_CurrentCellContainer(DataGridCell value)
bij System.Windows.Controls.DataGrid.set_FocusedCell(DataGridCell value)
bij System.Windows.Controls.DataGridCell.OnAnyGotFocus(Object sender, RoutedEventArgs e)
bij System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
bij System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
bij System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
bij System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
bij System.Windows.FrameworkElement.OnGotFocus(RoutedEventArgs e)