How can I show text with html format in xamarin forms

前端 未结 4 633
无人共我
无人共我 2020-12-17 19:03

I work on webservice with json and i get text with html format. I want my text have hyperlinks and some other properties where i find from html tags (etc. bold).

I t

4条回答
  •  抹茶落季
    2020-12-17 19:48

    This should work for you

    string htmlText = MyItem.Article.ToString().Replace(@"\", string.Empty);
    var browser = new WebView ();
    var html = new HtmlWebViewSource {
      Html = htmlText
    };
    browser.Source = html;
    

    Because Xamarin.Forms.HtmlWebViewSource.HTML expect a pure HTML. Using this you can create a Xamarin.Forms user control with the help of this article http://blog.falafel.com/creating-reusable-xaml-user-controls-xamarin-forms/ Cheers..!

提交回复
热议问题