The only examples I've been able to find online for binding text to a WinRT RichTextBlock
look like this:
<RichTextBlock>
<Paragraph>
<Run Text="{Binding Content}"/>
</Paragraph>
</RichTextBlock>
The only examples I've been able to find for actually showing rich text look like this:
<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>
How would I go about databinding the text of the RichTextBlock
to a property in my view model that may contain multiple paragraphs and runs? What type does that view model property need to be?
I've seen some references to using a FlowDocument
, but I can't tell if that will work with a RichTextBlock
. However, even those examples don't show any data binding to the document.