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>
码:
StorageFile file = await StorageFile.GetFileFromPathAsync(filePath);
IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);
this.RtfEula.Document.LoadFromStream(TextSetOptions.FormatRtf, stream);
RTF文件中由Word或写字板打开时可单击的绝对或相对HyperLink,仅显示为普通文本.
{\field{\*\fldinst HYPERLINK "http://www.microsoft.com"}{\fldrslt Microsoft}}
RTF规范中的“蓝色”显示为蓝色,但也处于无效状态.如果我将鼠标指针移到上面,它不会改变.
加载RTF文件时,是否可以在某些文本框中获取活动的HyperLink?
解决方法:
在代码中,您设置了IsHitTestVisible =“ False”.这将禁用所有输入交互.这就是为什么您的超级链接不可点击的原因.删除此设置或将其值更改为True应该可以解决您的问题.
<RichEditBox x:Name="RtfEula" IsFocusEngagementEnabled="False" IsReadOnly="True"
Background="{ThemeResource StandardBackground}" BorderThickness="0" TextWrapping="Wrap" />