FlowDocumentScrollViewer аварийно завершает работу при прокрутке - PullRequest
0 голосов
/ 06 июня 2018

Я работаю над приложением wpf, у которого есть FlowDocument, связанный с FlowDocumentScrollViewer.При прокрутке FlowDocumentScrollViewer я получаю исключение InvalidOperationException: «Этот TextNavigator» не имеет текстового элемента области видимости.и это приводит к сбою приложения.

Сведения об исключении:

System.InvalidOperationException: 'This TextNavigator' has no scoping text element.
at System.Windows.Documents.TextPointer.MoveToElementEdge(ElementEdge edge)
at System.Windows.Documents.TextPointer.System.Windows.Documents.ITextPointer.MoveToElementEdge(ElementEdge edge)
at System.Windows.Documents.TextPointerBase.GetFollowingNonMergeableInlineContentStart(ITextPointer position)
at System.Windows.Documents.TextSelection.get_PropertyPosition()
at System.Windows.Documents.TextSelection.GetCurrentValue(DependencyProperty formattingProperty)
at System.Windows.Documents.TextSelection.GetCaretBrush(TextEditor textEditor)
at System.Windows.Documents.TextSelection.UpdateCaretStateWorker(Object o)
at System.Windows.Documents.TextSelection.UpdateCaretState(CaretScrollMethod caretScrollMethod)
at System.Windows.Documents.TextSelection.System.Windows.Documents.ITextRange.NotifyChanged(Boolean disableScroll, Boolean skipEvents)
at System.Windows.Documents.TextRangeBase.EndChange(ITextRange thisRange, Boolean disableScroll, Boolean skipEvents)
at System.Windows.Documents.TextRange.System.Windows.Documents.ITextRange.EndChange(Boolean disableScroll, Boolean skipEvents)
at System.Windows.Documents.TextRange.ChangeBlock.System.IDisposable.Dispose()
at System.Windows.Documents.TextEditorMouse.OnMouseMoveWithFocus(TextEditor This, MouseEventArgs e)
at System.Windows.Documents.TextEditorMouse.OnMouseMove(Object sender, MouseEventArgs e)
at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(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, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) 

Я не получаю никаких исключений при создании FlowDocument.Я искал в Интернете, но не нашел информации, которая может помочь.

...