InvalidOperationException: 在 ItemsHost 面板上调用 Measure 后无法更改 ItemsControl 上的 VirtualizationMode 附加属性。 StackTrace: 在 System.Windows.Controls.VirtualizingStackPanel.SetVirtualizationState(IContainItemStorage itemStorageProvider, ItemsControl itemsControl, Boolean mustDisableVirtualization) 在 System.Windows.Controls.VirtualizingStackPanel.GetOwners(Boolean shouldSetVirtualizationState, Boolean isHorizontal, ItemsControl& itemsControl, GroupItem& groupItem, IContainItemStorage& itemStorageProvider, IHierarchicalVirtualizationAndScrollInfo& virtualizationInfoProvider, Object& parentItem, IContainItemStorage& parentItemStorageProvider, Boolean& mustDisableVirtualization) 在 System.Windows.Controls.VirtualizingStackPanel.MeasureOverrideImpl(Size constraint, Nullable`1& lastPageSafeOffset, List`1& previouslyMeasuredOffsets, Nullable`1& lastPagePixelSize, Boolean remeasure) 在 System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint) 在 System.Windows.FrameworkElement.MeasureCore(Size availableSize) 在 System.Windows.UIElement.Measure(Size availableSize) 在 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) 在 System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint) 在 System.Windows.FrameworkElement.MeasureCore(Size availableSize) 在 System.Windows.UIElement.Measure(Size availableSize) 在 System.Windows.ContextLayoutManager.UpdateLayout() 在 System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) 在 System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() 在 System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) 在 System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)