I must be missing something here. I've tried every possible way to make it so that anything is clickable inside a FlowDocument.
I've tried <Hyperlink>
(along with every possible way to assign NavigateUri
, RequestNavigate
and even the Hyperlink.Click
event - via XAML and pure code-behind), and I've tried placing a button in a <BlockUIContainer>
which still doesn't work.
The content renders correctly but clicking it does nothing.
I've also tried removing all Style
options so it's nothing more than a FlowDocument with 'stuff' in it, and have tried setting the RichTextBox
to IsReadOnly=True/False
. But no luck!
Example below. Where that <Hyperlink>
is, I've tried all possibilities, e.g. <BlockUIContainer>
etc. The end result is always that the element renders in the correct way, but clicking has no result at all.
//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;
}
Any pointers would be greatly appreciated. Thanks.