I am starting with Windows 8 and I am trying to convert HTML to a RichTextBlock
.
I have read that I could use this function : HtmlUtilities.ConvertToText
in a TextBlock
but I can't find a way to use this function in a RichTextBlock
!
From what I understand and tried I can't extend the RichTextBlock
so I can't apply this function everytime a RichTextBlock
is called.
Also, I can't find any way to bind text to a RichTextBlock
and building a parser just for simple HTML (I only want paragraphs and italics/bolds) seems an overkill. Also, I have no idea where I should do this parsing since I the RichTextBlock
seems unextendable.
I can't use the WebView
because I need transparency (and from what I have read the WebView doesn't have it).
EDIT
@mydogisbox made me see I was getting too far on my research.
I can use HtmlUtilities.ConvertToText
in the getter of a property that I can bind in the RichTextBlock
. I couldn't bind it because I was trying to do
<Run Text="{Binding TextHTML}" />
without a <Paragraph>
tag.
However HtmlUtilities.ConvertToText
doesn't preserve italics or bolds. Only paragraphs :/.