Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

XLabs HybridWebView.LoadContent Not Working

$
0
0

Hi everyone,

I wrote these code but load content is not worked.

I used xamarin.forms version 1.3.4 and XLabs version 2.0.5520

LoginPage.cs

public class LoginPage:ContentPage
{
HybridWebView _hybridWebView;
IDataSourceFactory _dataSourceFactory;

    public LoginPage ()
    {

        NavigationPage.SetHasNavigationBar (this, false);



        using (var scope = App.Container.BeginLifetimeScope ()) {  

            _hybridWebView = App.Container.Resolve<HybridWebView> ();
            _dataSourceFactory = App.Container.Resolve<IDataSourceFactory> ();

            _hybridWebView.HorizontalOptions = LayoutOptions.FillAndExpand;
            _hybridWebView.VerticalOptions = LayoutOptions.FillAndExpand;


            var loginController = new LoginController (
                _hybridWebView, 
                _dataSourceFactory);


            var login = new Login (){ Id = 1, Username = "Test", Password = "******" }; 

            var profitReportRazorView = new LoginView () { Model = login }; 
            var html = profitReportRazorView.GenerateString ();


            _hybridWebView.LoadContent (html.Replace("\r\n", ""));

--/*Html code is: <!DOCTYPE html>

My First Heading

My first paragraph.


*/--

            Content = _hybridWebView;

        }

    }
}

App.cs:

    public static bool IsOffline = false;
    IJsonSerializer _jsonSerializer;
    public static ContainerBuilder Builder;
    public static IContainer Container { get; set; }

    public App ()
    {

        Builder = new ContainerBuilder();

        Builder.RegisterInstance(new DataSourceFactory()).As<IDataSourceFactory>();
        Builder.RegisterInstance(new HybridWebView(_jsonSerializer));
        App.Container = Builder.Build ();
        // The root page of your application
        MainPage =new NavigationPage(new LoginPage()){BarBackgroundColor=Color.Silver};


    }

Anyone hlp pls? How can i solve?
Thnks.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>