gpt4 book ai didi

wpf - 如何在文本框中添加超链接和文本

转载 作者:行者123 更新时间:2023-12-02 21:42:37 25 4
gpt4 key购买 nike

这是我的代码:

<TextBlock TextWrapping="Wrap" TextAlignment="Left">
<TextBox IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap">
Please enter your details for login: questions follow the link
</TextBox>
<Hyperlink NavigateUri="https:" RequestNavigate="Hyperlink_RequestNavigate">
Reset Password
</Hyperlink>
</TextBlock>

文本框不允许我在文本中设置超链接。我需要将超链接保留在文本框中,这会创建一个新行。但我想要与文本串联的超链接。

我在 TextBlock 中使用 TextBox 的原因是为了使文本可选择。

最佳答案

我建议使用单个 RichTextBox 的解决方案:

    <RichTextBox IsReadOnly="True" IsDocumentEnabled="True" >
<FlowDocument>
<Paragraph>
Please enter your details for login: questions follow the link
<Hyperlink NavigateUri="https:" RequestNavigate="Hyperlink_RequestNavigate">Reset Password</Hyperlink>
</Paragraph>
</FlowDocument>
</RichTextBox>

关于wpf - 如何在文本框中添加超链接和文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20098327/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com