Skip to content Skip to sidebar Skip to footer

Using Webview To Display Local Page Html In My Crossplatform Xamarin App

i'm new in developing app with xamarin. I'm developing my first crossplatform app using xamarin forms. If you can give me the simpliest solution for my problem with examples. i h

Solution 1:

in xaml

<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">

   <WebView x:Name="webview" Source="{Binding mySource}"  />

</StackLayout>

in code behind or ViewModel

public HtmlWebViewSource mySource { get; set; } 

public MainPage()
{
   InitializeComponent();  
       
   webview.Source = "@"<html><body>
  <h1>Xamarin.Forms</h1>
  <p>Welcome to WebView.</p>
  </body></html>";";
}

Or you can use data binding(MVVM) .


Post a Comment for "Using Webview To Display Local Page Html In My Crossplatform Xamarin App"