Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8951239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:37:05+00:00 2026-06-15T13:37:05+00:00

I am starting with Windows 8 and I am trying to convert HTML to

  • 0

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 :/.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:37:06+00:00Added an answer on June 15, 2026 at 1:37 pm

    I ended up using a package avaiable on gitHub that converts from HTML to a RickTextBlock.

    Basiclly 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.

    Then you open RichTextBlockProperties.cs and you have the lines you need to copy. In my case I had to add the namespace:

    xmlns:rtbx="using:EventTests.Common"
    

    And then you can bind your property that has HTML using:

    <RichTextBlock rtbx:Properties.Html="{Binding ...}"/>
    

    Some problems and some solutions

    A problem I have found with this library is how it handles simple html with no divs. Like:

    <p>Testing <i>italic</i> and something more.</p>
    <p>More testing </p>
    

    This prints:

    Testing italic and something more.

    More testing

    However, I wanted something like this:

    Testing italic and something more.

    More testing

    So I had to wrap the second paragraph in a div (and all paragraphs except the first could be wrapped).

    <p>Testing <i>italic</i> and something more.</p>
    <div><p>More testing </p></div>
    

    If you wrap the first paragraph then you will have an extra new line.

    So far this is the best solution I have found. If you find better I apreciate it since I am testing and learning. If you find a better solution I will accept yours.

    Be carefull

    This approach will crash if you have symbols like "<" or "&" in your html. I suggest that you replace those chars before you try to use this library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have modified a working Windows service that had always been starting beforehand. After
We're starting a new project and are trying to decide to use either Windows
I have a Windows Service that I am trying to debug. Now it fails
I have been trying to use the new globbing feature in JDK7, starting from
I am just starting off Windows OEM development and have come across these two
It seems that starting with Windows Vista, processes with a lower integrity level (IL)
Windows provides only GetTickCount up to Windows Vista and starting from that OS also
I'm trying to get the following example from Use Windows PowerShell to Manage Virtual
I'm trying to debug a windows mobile app. The app is starting and is
I am trying to change the starting program for a particular user. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.