When scrolling back to the beginning card of the view quickly (dragging on the scroll bar back and forth), the grid throws an exception and crashes the application both in Visual Studio 2008/2010 and using the Xceed WPF binaries for versions 3.7 and 4.0.
The exception I receive is:
InvalidOperationException (Specified element is already the logical child
of another element. Disconnect it first.) was unhandled ... with the
following stacktrace:
at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject
newParent)
at System.Windows.FrameworkElement.AddLogicalChild(Object child)
at
System.Windows.Controls.ContentControl.OnContentChanged(DependencyObject d,
DependencyPropertyChangedEventArgs e)
at System.Windows.PropertyChangedCallback.Invoke(DependencyObject d,
DependencyPropertyChangedEventArgs e)
at
System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs
e)
at
System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs
e)
at
System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs
args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex
entryIndex, DependencyProperty dp, PropertyMetadata metadata,
EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean
coerceWithDeferredReference, OperationType operationType)
at
System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
at System.Windows.Data.BindingExpression.Invalidate(Boolean
isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue,
Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.Activate(Object item)
at
System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject
d, DependencyPropertyChangedEventArgs args)
at
System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject
d, DependencyPropertyChangedEventArgs args)
at System.Windows.DependentList.InvalidateDependents(DependencyObject
source, DependencyPropertyChangedEventArgs sourceArgs)
at
System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs
args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex
entryIndex, DependencyProperty dp, PropertyMetadata metadata,
EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean
coerceWithDeferredReference, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty
dp, Object value, PropertyMetadata metadata, Boolean
coerceWithDeferredReference, OperationType operationType, Boolean
isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp,
Object value)
at System.Windows.FrameworkElement.set_DataContext(Object value)
at Xceed.Wpf.DataGrid.Cell.AssignDataContext(Cell cell, Object
dataContext, ColumnBase parentColumn, Boolean& isNewDataContext)
at Xceed.Wpf.DataGrid.Cell.PrepareContainer(DataGridContext
dataGridContext, Object item)
at Xceed.Wpf.DataGrid.DataCell.PrepareContainer(DataGridContext
dataGridContext, Object item)
at Xceed.Wpf.DataGrid.Row.PrepareContainer(DataGridContext
dataGridContext, Object item)
at Xceed.Wpf.DataGrid.DataRow.PrepareContainer(DataGridContext
dataGridContext, Object item)
at
Xceed.Wpf.DataGrid.Row.Xceed.Wpf.DataGrid.IDataGridItemContainer.PrepareContainer(DataGridContext
dataGridContext, Object item)
at
Xceed.Wpf.DataGrid.DataGridControl.PrepareContainerForItemOverride(DependencyObject
element, Object item)
at
Xceed.Wpf.DataGrid.DataGridControl.PrepareItemContainer(DependencyObject
container, Object item)
at
Xceed.Wpf.DataGrid.CustomItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject
container)
at Xceed.Wpf.DataGrid.Views.CardflowItemsHost.GenerateContainers()
at Xceed.Wpf.DataGrid.Views.CardflowItemsHost.GeneratorTimerTick(Object
sender, EventArgs e)
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate
callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object
source, Delegate callback, Object args, Boolean isSingleParameter, Delegate
catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Threading.ExecutionContext.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32
msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam,
IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate
callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object
source, Delegate callback, Object args, Boolean isSingleParameter, Delegate
catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority
priority, TimeSpan timeout, Delegate method, Object args, Boolean
isSingleParameter)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr
wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG&
msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame
frame)
at System.Windows.Application.RunInternal(Window window)
at FarsightAlphaUserInterface.Application.Main() in
C:\Users\Vivien\Documents\Visual Studio
2008\Projects\FarSight\prototypes\FarsightAlphaUserInterface\obj\Debug\Application.g.vb:line
62
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()