private static Rect GetVisualRectangle(RichTextBlock textBlock, TextPointer textPointer) { UIElement container = textPointer.VisualParent; Rect beforeTransform = textPointer.GetCharacterRect(LogicalDirection.Forward); GeneralTransform transform = container.TransformToVisual(null); Rect afterTransform = transform.TransformBounds(beforeTransform); return afterTransform; }
private static void RaiseCreateSceneLinkEvent(TextPointer start, TextPointer end) { FrameworkElement element = start.VisualParent; if (null != element) { SceneViewModel scene = element.DataContext as SceneViewModel; if (null != scene) { scene.CreateLinkAt(start, end); } } }