Вопрос

how can I format this html code:

<p>For the iPhone do the following:
<ul>
<li>Go to AppStore</li>
<li>Search by M&#229lApp</li>
<li>Download</li></ul>
</p><p>
Android To do this:
<ul>
<li>Go to the Market</li>
<li>Search by M&#229lApp</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:

  • Go to AppStore
  • Search by MålApp
  • Download

Android To do this:

  • Go to the Market
  • Search by MålApp
  • Download

Это было полезно?

Решение

In your code you can Replace < li > tags with & # 8226 ;

See http://www.fileformat.info/info/unicode/char/2022/index.htm

Другие советы

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top