3

I found the very useful post presenting a solution for a selectable wpf textbox:

SelectableTextBlock (by torvin)

The TextEditorWrapper is great,

But if I set the TextTrimming property to e.g. TextTrimming="CharacterEllipsis", an exception occurrs, if the mouse moves over the ....

Exception:

Message: The requested distance is outside the content of the associated document.
Stacktrace:
   bei System.Windows.Documents.TextPointer.InitializeOffset(TextPointer position, Int32 distance, LogicalDirection direction)
   bei System.Windows.Documents.TextPointer.System.Windows.Documents.ITextPointer.CreatePointer(Int32 offset, LogicalDirection gravity)
   bei System.Windows.Controls.TextBlock.GetTextPositionFromDistance(Int32 dcp, Double distance, Double lineVOffset, Int32 index)
   bei MS.Internal.Text.TextLineResult.GetTextPositionFromDistance(Double distance)
   bei MS.Internal.Documents.TextParagraphView.GetTextPositionFromPoint(ReadOnlyCollection`1 lines, Point point, Boolean snapToText)
   bei MS.Internal.Documents.TextParagraphView.GetTextPositionFromPoint(Point point, Boolean snapToText)
   bei MS.Internal.Documents.TextViewBase.System.Windows.Documents.ITextView.GetTextPositionFromPoint(Point point, Boolean snapToText)
   bei System.Windows.Documents.TextEditorMouse.IsPointWithinInteractiveArea(TextEditor textEditor, Point point)
   bei System.Windows.Documents.TextEditorMouse.OnQueryCursor(Object sender, QueryCursorEventArgs e)
   bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   bei System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   bei System.Windows.Input.InputManager.ProcessStagingArea()
   bei System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   bei System.Windows.Input.MouseDevice.UpdateCursorPrivate()
   bei System.Windows.Input.MouseDevice.PostProcessInput(Object sender, ProcessInputEventArgs e)
   bei System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
   bei System.Windows.Input.InputManager.ProcessStagingArea()
   bei System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   bei System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   bei System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   bei System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

How can this be solved?

cew3
  • 73
  • 6

0 Answers0