I would like to return the TextPointer to an arbitrary (nth) character position (including whitespace) of RichTextBox XAML.
Given "Mary had a little lamb".ÃÂ I would like to return a text pointer corresponding to the letter position 8, (in this case, I would get a TextPointer for the insertion point just before the letter 'd' in 'had'). This would need to ignore any formatting elements and other UI elements in the xml anywhere in the text.
ÃÂ I think this would be similar to the method
but which ignores all symbols other than character data (recalling that GetPositionAtOffset includes all "symbols", not only text).
Performance: I realize that I could write a function which moves a TextPointer one position at a time and inspects what type of symbol is found at each spot and stops when it gets to the Nth character. But that seems very expensive. I am hoping there is a built in function which is more performant. (and I would really have thought this might be part of the System.Windows.DocumentsÃÂ API)
ÃÂ thanks very much.
View Complete Post