我在 .Net 4.0 和 WPF DataGrid 中使用 C#。有时我在程序执行过程中遇到以下异常。如果我更改某些列的值,则会抛出异常。DataGrid 的虚拟化已激活(但仅对于行,列虚拟化设置为 false)。现在我需要知道它是否是 .Net 中的错误。
An unhandled exception occured in GUI. Stack Trace - "System.NullReferenceException:
Object reference not set to an instance of an object.
at System.Windows.Controls.DataGridCell.OnCoerceIsReadOnly(DependencyObject d, Object
baseValue)
at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp,
PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex,
EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object
baseValue, Object controlValue, CoerceValueCallback coerceValueCallback, Boolean
coerceWithDeferredReference, Boolean coerceWithCurrentValue, Boolean
skipBaseValueChecks)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex,
DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry,
EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean
coerceWithCurrentValue, OperationType …Run Code Online (Sandbox Code Playgroud)