I have created an adornerlayer over wpf textbox.
This code block will return the bounds of the text in textbox, i have written this block in onrender method of a adorner class.
Rect startPosition = textBox.GetRectFromCharacterIndex(startingCharOfAWord);
Rect endPosition = textBox.GetRectFromCharacterIndex(endingCharOfAWord,true);
Rect rectUnion = Rect.Union(startPosition, endPosition);
using this(rectPosition) position i can highlight the text in the textbox.
My Question : My textbox has more than 500 words. I need to scroll to read the text in the textbox. while scrolling in it, i used PreviewMouseWheel Event to update the adorner layer. But Rect returns empty. So i can't able get the bounds of the text.
Suggest me an idea to get Rect value of the text when scrolling the text in the texbox.