Reputation: 2682
how can I format this html code:
<p>For the iPhone do the following:
<ul>
<li>Go to AppStore</li>
<li>Search by MålApp</li>
<li>Download</li></ul>
</p><p>
Android To do this:
<ul>
<li>Go to the Market</li>
<li>Search by MålApp</li>
<li>Download</li>
</ul>
</p>
into XAML for RichTextBox in Windows Phone?
Update
so in result it should be:
For the iPhone do the following:
Android To do this:
Upvotes: 1
Views: 2433
Reputation: 65556
The basic approach is to verify the html as valid and then walk the content converting to the XAML equivalent.
There are lots of examples of attempting this online
It is far more performant to do such a conversion on a server and pull the formatted version to the phone and then display with XamlReader.Load.
Update
For each element in the HTML you'll just be adding a new TextBlock to a container (probably a StackPanel
) and for the <li>
items you'll just want to prefix with a symbol to represent the bullet and adjust the left margin appropriately. You'll probably benefit from defining appropriate styles and then just applying the appropriate style for the element you're converting.
Upvotes: 1
Reputation:
In your code you can Replace < li > tags with & # 8226 ;
See http://www.fileformat.info/info/unicode/char/2022/index.htm
Upvotes: 2