Example #1
0
        private Rect GetCaretRect()
        {
            Rect rect;

            if (_editor is TextBox)
            {
                TextBox textBox = _editor as TextBox;
                rect = textBox.GetRectFromCharacterIndex(textBox.CaretIndex);
            }
            else
            {
                RichTextBox richTextBox = _editor as RichTextBox;
                rect = richTextBox.CaretPosition.GetCharacterRect(LogicalDirection.Forward);
            }
            rect.Location = _editor.PointToScreenLogical(rect.Location);
            return(rect);
        }