use*_*468 2 wpf textbox textblock hyperlink
这是我的代码:
<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>
Run Code Online (Sandbox Code Playgroud)
文本框不允许我在文本中设置超链接。我需要将超链接保留在文本框中,这会创建一个新行。但我想要与文本串联的超链接。
我在 TextBlock 中使用 TextBox 的原因是为了使文本可选择。
我建议使用 single 的解决方案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>
Run Code Online (Sandbox Code Playgroud)