我一定在这里想念什么。我已经尝试了所有可能的方法来使任何在FlowDocument中都可以单击。
我已经尝试过<Hyperlink>
(以及通过XAML和纯代码背后分配NavigateUri
,RequestNavigate
甚至Hyperlink.Click
事件的所有可能方法),并且我尝试将按钮放在<BlockUIContainer>
上,但这仍然无效。
内容正确呈现,但是单击它不会执行任何操作。
我还尝试了删除所有Style
选项,因此它仅是其中包含'stuff'的FlowDocument,并且尝试将RichTextBox
设置为IsReadOnly=True/False
。但是没有运气!
以下示例。 <Hyperlink>
在哪里,我已经尝试了所有可能,例如<BlockUIContainer>
等。最终结果始终是元素以正确的方式呈现,但单击根本没有结果。
//XAML
<RichTextBox IsReadOnly="True">
<FlowDocument>
<Paragraph>
1.1.3 Course technology requirements
</Paragraph>
<Paragraph>
<Run>
access to an internet connection and a standard,modern web
browser are the only necessary requirements of the course.
If you are using an old or outdated browser,such as Internet
Explorer,you may need to update. We recommend
</Run>
<Hyperlink x:Name="GoogleChromeLink"
NavigateUri="https://www.google.com/chrome/"
RequestNavigate="Hyperlink_RequestNavigate" >
Google Chrome.
</Hyperlink>
</Paragraph>
</FlowDocument>
</RichTextBox>
// C#
private void Hyperlink_RequestNavigate(object sender,RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
任何指针将不胜感激。谢谢。