![]() ![]() I suggest that you replace those chars before you try to use this library. There is a commercial, easy to use RTF to HTML / RTF to XHTML converter library for Delphi called ScroogeXHTML, which can be configured to process only basic font properties. This approach will crash if you have symbols like "<" or "&" in your html. If you find a better solution I will accept yours. If you find better I apreciate it since I am testing and learning. ![]() So far this is the best solution I have found. If you wrap the first paragraph then you will have an extra new line. So I had to wrap the second paragraph in a div (and all paragraphs except the first could be wrapped). In my case I had to add the namespace: xmlns:rtbx="using:EventTests.Common"Īnd then you can bind your property that has HTML using: Ī problem I have found with this library is how it handles simple html with no divs. Then you open RichTextBlockProperties.cs and you have the lines you need to copy. I ended up using a package avaiable on gitHub that converts from HTML to a RickTextBlock.īasiclly you only need to open the Package Manager Console (Tools > Library Package Manager > Package Manager Console) and install the package running Install-Package RichTextBlock.Html2Xaml. ![]() However HtmlUtilities.ConvertToText doesn't preserve italics or bolds. I couldn't bind it because I was trying to do I can use HtmlUtilities.ConvertToText in the getter of a property that I can bind in the RichTextBlock. I can't use the WebView because I need transparency (and from what I have read the WebView doesn't have made me see I was getting too far on my research. Also, I have no idea where I should do this parsing since I the RichTextBlock seems unextendable. I would like to convert a RichTextBox with Formatting (Bold/Italic/Bullet.) to HTML string. 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!įrom what I understand and tried I can't extend the RichTextBlock so I can't apply this function everytime a RichTextBlock is called.Īlso, 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. I am starting with Windows 8 and I am trying to convert HTML to a RichTextBlock. ![]()
0 Comments
Leave a Reply. |