Wpf EnableColumnVirtualization=true更改selectedItem

Wpf EnableColumnVirtualization=true更改selectedItem,wpf,mvvm-light,ui-virtualization,Wpf,Mvvm Light,Ui Virtualization,根据我设定的msdn建议 <Setter Property="EnableRowVirtualization" Value="True"/> <Setter Property="EnableColumnVirtualization" Value="True"/> 但我认识到,如果我将EnableColumnVirtualization设置为true,当我水平滚动到时,它会导致所选项目发生更改并触发它。我在两个面板上使用MvvmLight互相更新。

根据我设定的msdn建议

  <Setter Property="EnableRowVirtualization" Value="True"/>
        <Setter Property="EnableColumnVirtualization" Value="True"/>

但我认识到,如果我将EnableColumnVirtualization设置为true,当我水平滚动到时,它会导致所选项目发生更改并触发它。我在两个面板上使用MvvmLight互相更新。触发所选项目时发送消息。当我每次滚动时,水平滚动变得很痛苦,它会触发selecteditem更改并弹出错误消息,如下所示

System.NotSupportedException: A second operation started on this context before a previous asynchronous operation completed. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context. Any instance members are not guaranteed to be thread safe.
at System.Data.Entity.Internal.ThrowingMonitor.Enter()
at System.Data.Entity.Core.Objects.ObjectQuery`1.<GetResultsAsync>d__e.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Data.Entity.Internal.LazyAsyncEnumerator`1.<FirstMoveNextAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Data.Entity.Infrastructure.IDbAsyncEnumerableExtensions.<FirstOrDefaultAsync>d__25`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
**at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Identity.AsyncHelper.RunSync[TResult](Func`1 func)
System.NotSupportedException:在上一个异步操作完成之前,在此上下文上启动了第二个操作。使用“await”确保在此上下文上调用另一个方法之前已完成任何异步操作。任何实例成员都不能保证线程安全。
在System.Data.Entity.Internal.ThrowingMonitor.Enter()中
在System.Data.Entity.Core.Objects.ObjectQuery`1.d_ue.MoveNext()中
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在System.Data.Entity.Internal.LazyAsyncEnumerator`1.d_u0.MoveNext()中
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
位于System.Data.Entity.Infrastructure.IDbAsyncEnumerableExtensions.d_u25`1.MoveNext()
---来自引发异常的上一个位置的堆栈结束跟踪---
**at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
位于Microsoft.AspNet.Identity.AsyncHelper.RunSync[TResult](Func`1 Func)

当我将虚拟化设置为false时,一切都很顺利。因此,我想知道,是这种情况,我不能使用虚拟化,还是有解决办法?

是否真的需要虚拟化?您要显示多少项?我个人从未遇到过需要虚拟化的情况,它就像17k行和30列。我认为虚拟化可以让这么多数据更容易滚动