问题
I'm attempting to "Tokenize" text inside of a WPF RichTextBox control. Whenever the user types a ";", the text before it is placed into a new TextBox contained within an InlineUiContainer. This allows the text to be programmatically different, and yet still be editable.
I was able to remove the border and make the background transparent so that the text looks to be directly inside of the RichTextBox, as desired; however, if you attempt to select only a portion of the text in a "token" and some text outside of it, the whole text box is selected regardless.
My question then is this: is there a way to make the textbox seamlessly selectable? and perhaps to make it so cursoring left/right with the arrows to move into the textbox rather than cursoring over it?
回答1:
I just ended up using an extension of the Run class.
来源:https://stackoverflow.com/questions/13485533/wpf-richtextbox-seamless-textboxes-as-inlineuicontainers