none
RichTextBox and custom popup

    Question

  • Hi,

    I want to position a popup near the RichTextBox.CaretPosition after a user has entered some key combination. The problem is that the contents of the RichTextBox.Document are block element that did not have Height and Width. Does anyone had an idea how to achieve this?
    Saturday, July 07, 2007 5:28 PM

Answers

  • From RichTextBox.CaretPosition.GetCharacterRect() you should be able to get the cordinates of the caret with respect to RichTextBox.

    Thursday, July 26, 2007 1:17 AM
    Moderator

All replies

  • For now my only option is to loop through all the block and all their inlines and calculate the FontSize or width (if there are some UIElement in the document).

    However I'm interested how the AnnotationService displays their popup for adding annotations over selected text. Looking at its code it seems complex and messy. Any ideas?
    Tuesday, July 10, 2007 9:42 AM
  • From RichTextBox.CaretPosition.GetCharacterRect() you should be able to get the cordinates of the caret with respect to RichTextBox.

    Thursday, July 26, 2007 1:17 AM
    Moderator