如何检测超链接文本更改?

发布于 2025-01-24 15:57:06 字数 409 浏览 2 评论 0原文

我拥有带有一些超链接的RichTextbox,这些超链接允许用户更改其文本,并且在更改文本时,我需要采取进一步的操作。超链接本身没有什么特别的,就像下面:

Hyperlink link = new Hyperlink();
Run run = new Run("haha");
link.Inlines.Add(run);

当用户在链接中输入时,我想检测到该用户操作并做出进一步的动作,类似:

link.textchanged += myHandler;

到目前为止,我尝试使用文本框作为超链接的内联,尽管它有效,但是当没有足够的空间时,有很多缺点,例如自动切换到下一行。

我还尝试使用TexTrange.Changed方法,但它不起作用。

谢谢!

I have this richtextbox with some hyperlinks, these hyperlinks allows users to change the text of it, and I need to make further actions when the text of it is changed. The hyperlink itself has nothing special, just like below:

Hyperlink link = new Hyperlink();
Run run = new Run("haha");
link.Inlines.Add(run);

When the users type within the link, I would like to detect that user action and make further moves, something like:

link.textchanged += myHandler;

So far, I tried to use textBox as the inline of the hyperlink, though it works, but there are so many downsides such as it automatically switch to the next line when there's no enough space.

I also tried to use textrange.changed method, but it did not work.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文