MadhuLi-9634 avatar image
0 Votes"
MadhuLi-9634 asked AryaDing-MSFT commented

UWP HTML data display


We need to implement a screen like below in a UWP app where we need to show around 500 - 1000 steps like below.
Each step can have plain text or rich text which includes bold, italic, underline, bullet, numbering and other characters, superscript, subscript etc.. Like in this example.


And we have the data in html/xml format like below for example. We are trying to decide what is the best UWP component to use for this. Using web views for each of these steps/rows might be one option, but I have heard that web views are heavy weight and we shouldn't use them as it can cause memory issues etc.. (as we need to show 500-1000 of steps like that). Please share your thoughts on that. And what is the component you can suggest to implement this.

<p><span style="color:#000000;">Step 1 wit text </span><b><span style="color:#000000;">Aalsfs </span></b><span style="color:#000000;">sfsfls </span><i><span style="color:#000000;"><u>fsdfj </u></span></i><span style="color:#000000;">slfjdslf j</span><b><i><span style="color:#000000;"><u>sdlfkjsd</u></span></i></b><b><i><span style="color:#000000;"><u> fsdf sdfsdfsdfsdfdsf</u></span></i></b><span style="color:#000000;"> Sfs. </span><sub>SDLfsjfls </sub><span style="color:#000000;">fsdlkfjdslfsdjflsdf. </span><sup>Slskfjs </sup><span style="color:#000000;">fsflsdjfd sf sdf. </span></p><ol style="list-style-type:decimal;"><li><p><span style="color:#000000;">aa</span></p></li><li><p><span style="color:#000000;">bb</span></p></li><li><p><span style="color:#000000;">cc</span></p></li></ol><p><span style="color:#000000;"> </span></p>


2.png (35.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AryaDing-MSFT avatar image
0 Votes"
AryaDing-MSFT answered AryaDing-MSFT commented


Welcome to Microsoft Q&A!

You could use RichTextBlock to show html content. Please refer the following steps to do this.

1.Create a class library, register dependency property for RichTextBlock.

2.Parse the Html document and generate the corresponding Block or Inline based on the tag type by recursion.

3.Write conversion methods for various tags

4.Reference the class library in uwp project, convert html to string type and bind it to RichTextBlock property

You could find more information here, which is still available even though it has expired. That sample captures most of the elements, you could expand the analysis according to specific situation.

In addition, I’m not very clear about your issue. Could you please tell me why you can’t combine these 500 steps to a html file and display them in a webView?

If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AryaDing-MSFT Thank you very much for the details.
We can't hard code these in a html as these are all Dynamic data. Different items in our app can have different number of Steps and all these steps data is read from the server and shown here. And for each step we have different actions defined with different button at the right side like adding comments adding photos and viewing different info related to those steps. So we'll have to show each of these steps and actions related to each steps one by one.

0 Votes 0 ·

@MadhuLi-9634 The key to this way is parsing the html structure and converting the tag to the text type that RichTextBlock supported. Please refer to this document to know more supported text types.

0 Votes 0 ·