WPF RichTextBox seamless TextBoxes as InlineUIContainers

一曲冷凌霜 提交于 2020-01-25 00:21:06

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!