确定所选文本是否是 RichTextBox 中的超链接?
我还希望用所选超链接的 URL 填充文本框。我认为我沿着这段代码的正确道路,但我不知道如何完成它:
TextPointer position = RichTextBoxEditor.Selection.Start;
Inline parent = position.Parent as Inline;
foreach (Hyperlink hl in RichTextBoxEditor.Blocks.OfType<Hyperlink>())
{
}
I also am hoping to populate a text box with the URL of the selected Hyperlink. I think I am along the right path with this code, but I don't know how to complete it:
TextPointer position = RichTextBoxEditor.Selection.Start;
Inline parent = position.Parent as Inline;
foreach (Hyperlink hl in RichTextBoxEditor.Blocks.OfType<Hyperlink>())
{
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的...您走在正确的道路上。以前从未做过,但如果您的光标位于超链接内,则会为您提供超链接:
Yes... you are in the right path. Never done before but if your cursor is inside an hyperlink this gives you the hyperlink: