我能够在网上找到的将文本绑定到 WinRT 的唯一示例RichTextBlock
如下所示:
<RichTextBlock>
<Paragraph>
<Run Text="{Binding Content}"/>
</Paragraph>
</RichTextBlock>
我能够找到的实际显示富文本的唯一示例如下所示:
<RichTextBlock>
<Paragraph>
<Run>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ligula nisi, vehicula nec eleifend vel, rutrum non dolor. Vestibulum ante ipsum primis in faucibus orci</Run>
<Run FontSize="30">luctus</Run>
<Run>et ultrices posuere cubilia Curae; Curabitur elementum scelerisque accumsan. In hac habitasse platea dictumst. Maecenas eu nibh vitae nibh laoreet placerat. Duis dolor ante, semper luctus ullamcorper eget, placerat et ligula. Donec placerat tincidunt vehicula. Fusce condimentum lacus quis libero blandit semper sed vel quam. Proin eget nisl lacinia nibh convallis scelerisque at sed massa. Duis commodo tincidunt consequat. Duis malesuada, nisl a pharetra placerat, odio dui suscipit quam, vitae rhoncus sem risus quis odio. Aliquam justo nunc, adipiscing id elementum sit amet, feugiat vel enim. Aliquam pharetra arcu nec elit luctus euismod. Suspendisse potenti.</Run>
</Paragraph>
</RichTextBlock>
我将如何将文本数据绑定RichTextBlock
到我的视图模型中可能包含多个段落并运行的属性?该视图模型属性需要是什么类型?
我看过一些关于使用 a 的参考资料FlowDocument
,但我不知道这是否适用于 a RichTextBlock
。但是,即使这些示例也没有显示任何与文档的数据绑定。