James
James

Reputation: 223

Xamarin - HtmlWebViewSource and XAML

I trying to display an HTML from a model inside of WebView control. After some googling, I realised that I cannot use the Source property as it is meant to be populated only with URL or URI.

After a couple additional searches, I came across HtmlWebViewSource but I can't find a single example of using HtmlWebViewSource via XAML.

Does anyone have a clue how to define an instance of HtmlWebViewSource in XAML, bind HTML from the model and assign it to WebView

thanks!

Upvotes: 2

Views: 2670

Answers (1)

James
James

Reputation: 223

To answer myself

<WebView x:Name="_webView" HorizontalOptions="Fill" VerticalOptions="EndAndExpand">
     <WebView.Source>
         <HtmlWebViewSource
         Html="{Binding HTMLSource}" />
     </WebView.Source>
</WebView>

Upvotes: 2

Related Questions