Reputation: 83
XAML:
<ScrollViewer x:Name="RtfEulaViewer" Grid.Row="1" VerticalAlignment="Top">
<RichEditBox x:Name="RtfEula" IsHitTestVisible="False" IsFocusEngagementEnabled="False" IsReadOnly="True"
Background="{ThemeResource StandardBackground}" BorderThickness="0" TextWrapping="Wrap" />
</ScrollViewer>
Code:
StorageFile file = await StorageFile.GetFileFromPathAsync(filePath);
IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);
this.RtfEula.Document.LoadFromStream(TextSetOptions.FormatRtf, stream);
Absolute or relative HyperLinks in the RTF file that are click-able when it is opened by Word or WordPad, are just shown as normal text.
{\field{\*\fldinst HYPERLINK "http://www.microsoft.com"}{\fldrslt Microsoft}}
from the RTF specification is displayed in blue colour but is also inactive. The mouse pointer does not change if I move over it.
Is there a way to get active HyperLinks in some text box when loading an RTF file?
Upvotes: 4
Views: 413
Reputation: 15758
In your code, you've set IsHitTestVisible="False"
. This will disable all input interaction. That's why your hyper link is not clickable. Removing this setting or changing its value to True
should be able to solve your issue.
<RichEditBox x:Name="RtfEula" IsFocusEngagementEnabled="False" IsReadOnly="True"
Background="{ThemeResource StandardBackground}" BorderThickness="0" TextWrapping="Wrap" />
Upvotes: 4