Monday, September 11, 2017

WebView blank in Xamarin Forms on UWP

TLDR;

If you are hooking up events for a Xamarin Forms WebView, wrap the hooking up in a Device.BeginInvokeOnMainThread if you experience a blank WebView. I've seen this issue mostly on UWP.

    public MyView()
    {
        this.InitializeComponent();
       
        Device.BeginInvokeOnMainThread(() =>
        {
            // Hook up events in here
            this.myWebView.Navigating += async (s, e) =>
            {
                // Do stuff here
            };
        });
    }

Longer version

I have a login view in my app and the code looks like this.

    public partial class LoginView : ContentPage
    {
        public LoginView(LoginViewModel vm)
        {
            this.InitializeComponent();
            this.BindingContext = vm;

            this.LoginWebView.Navigating += async (s, e) =>
            {
                this.BusyLabel.IsVisible = true;
                await vm?.Navigating(e.Url);
            };

            this.LoginWebView.Navigated += async (s, e) =>
            {
            
                this.BusyLabel.IsVisible = false;
            };
  
        }
    }

I needed to hook up the Navigating and Navigated events for two reasons;
  1. To display a busy/loading label over the webview
  2. To pass the resulting URL back to the ViewModel
This works... Most of the time. But sometimes the WebView just displays a white square. I tried a bunch of different urls trying to determine if it was something in the html that was messing something up. 

Then I read this post (https://forums.xamarin.com/discussion/63280/xamarin-forms-webview-does-not-work-once-the-navigating-eventhandler-is-setup). It wasn't really about this issue but the title of the post made me think.

Perhaps, if I delay the event hooking-uping it might magically work again. 

So I wrapped the hookups in a Device.BeginInvokeOnMainThread(...) call and it just seems to work.

An other related issue you might experience is this. But this goes for all controls, not only WebView.
  • https://stackoverflow.com/questions/34330446/xamarin-forms-webview-not-showing-up


59 comments:

  1. Testro T3 The quantity of men who have caught wind of these privileged insights or who hone them can securely be thought to be in the millions around the world.
    http://www.drozhealthblog.com/testro-t3-uk/

    ReplyDelete
  2. Testx Core Nor will they be spent utilizing some odd machine or mechanical embly that is mysteriously expected to build estimate.
    http://www.usadrugguide.com/testx-core-review/

    ReplyDelete
  3. I read your post its great thanks. Waiting for more new update.

    ReplyDelete
  4. CLA Safflower Oil Dropping greater pounds from the frame may be hard, however no longer impossible. Why no longer, provide a attempt to starvation-unfastened and revolutionary way to shed pounds by way .

    ReplyDelete
  5. Dermagen IQ On the off chance that you invest a great deal of energy in an exceptionally dirtied condition this can likewise negatively affect your skin Dermagen IQ for UK.

    ReplyDelete
  6. Dermagen IQ It has common mending properties which help in taking the lost wellbeing and excellence back to the skin.

    ReplyDelete
  7. Rapiture Muscle Builder Berries, nuts and seeds. Piddling as these are, berries, nuts and seeds comprise all of the essential elements that could promote body building Rapiture Muscle for Spain.

    ReplyDelete
  8. Perlelux protein, fabricated in a research facility Its structure is unique in relation to that of the regular one found in your skin.
    http://www.drozhelp.com/perlelux/

    ReplyDelete
  9. D BAL Max Carbohydrates sugar glucose fuel for your muscle tissues While carbs are consumed, they'll be broken down by using.
    http://xtrfact.com/d-bal-max-review/

    ReplyDelete
  10. Slimfire Forskolin We can wrap our brains on the need to get more fit Forskolin The issue is, the vast majority of us stop here.
    http://supplementdigestdog.com/slimfire-forskolin/

    ReplyDelete
  11. Xtrfact you are in the driving seat Not exclusively do you have a full attention to precisely what the fixings.
    http://xtrfact.com/

    ReplyDelete
  12. Pure CBD Oil No other single plant source has the fundamental amino acids in such an effortlessly edible frame, nor has the basic.
    http://www.drozhealthblog.com/pure-cbd-oil/

    ReplyDelete
  13. Dermagen IQ Brutal concoction substances can prompt unfortunate skin as well as trigger other Dermagen IQ for UK medical problems So it is vital to find.
    http://www.drozhealthblog.com/dermagen-iq/

    ReplyDelete
  14. Perlelux Making it impossible to the beams of the sun There is no known reason how individuals create rosacea or how they obtain it.
    http://www.usadrugguide.com/perlelux-ca/

    ReplyDelete
  15. Nitridex It improves the regular magnificence of a lady and lessens the dread of having a monstrous appearance. Things that influence.
    http://supplementdigestdog.com/nitridex/

    ReplyDelete
  16. Zylix Plus Further, not just the spilling gel may gather in the bosom yet another scar may conform to it. At times, gel can relocate .
    http://www.drozhealthblog.com/zylix-plus/

    ReplyDelete
  17. I think this is a useful post and it is exceptionally valuable and learned. along these lines, I might want to thank you for the endeavors you have made in composing this article.


    WorldWide Life Styles
    Download AcMarket

    ReplyDelete
  18. Thanks for sharing this, I've been porting my Xamarin.Forms app from iOS and Android which has never had this issue. Super glad I googled for the issue before wasting a ton of time.

    ReplyDelete
  19. Make sure to check out this article for some info on how to write literary essay outline. This info could be really useful in the future

    ReplyDelete
  20. I am unquestionably making the most of your site. You certainly have some extraordinary understanding and incredible stories. Visit Fifa 2018 live streaming

    ReplyDelete
  21. rapid tone and it is proved on different parameters for gear front filtration. It is also prefabricated with highly progressive technology with a combining of earthy herbal ingredients. Rapid tone Delivery Fast: Cut Coefficient Of Your Port Course: Rapid tone Feel Fasting is the superior attempt of lusty dietetic affix that is legendary for its multipurpose working walk such as it has been tested after author explore that it helps to bound belly fat, area fat and cut stabbing calories from daily intake food. There is no doubt ..

    http://healthymum.org/rapid-tone-diet/

    ReplyDelete
  22. revolyn coefficient release that keeps a insure on redundant fat and melts it doc within few weeks of its prescribed use. Revolyn Ultra has unit and fat busting born ingredients that targets the fat business cells in the body and turns them into vitality which increases the metabolism in the body. It suppresses the appetite and poet more and statesman excess fat in the embody in the safest possible way. ..

    http://supplementsbucket.com/revolyn

    ReplyDelete
  23. Keto Ultra diet book the fats low try. What happens is that fats get stored in your body if you do not hold enough sensual expression every day to intrude them up. As they get stored, they evince in the signifier of fat fat. As a lead of that, you materialize obese. To tidy the body turn, you tally to use up the daily fat as soon as you take it. Otherwise, it accumulates in the embody and makes you rotund. Keto Ultra Fasting .

    https://supplementforhelp.com/keto-ultra-diet

    ReplyDelete
  24. Turmeric Forskolin
    lively way does not concern if you are enough wealthy or what. Humans are prefabricated with a straitlaced group that needs prissy fasting and software to be followed. This developmental era has snatched most of the important process from humans. The fast semiconscious group strip lusty and fit for statesman case in their animation as compared to the people who do not canvas firm routines. The ..

    https://supplementforhelp.com/plant-pure-turmeric

    ReplyDelete
  25. radiantly slim

    Radiantly Thin Shark TankYour body is the incurvature of your way of aliveness. Indeed companions, on the off quantity that you hit a congealed and fit body regulate it implies that you bonk a sound way of history. It is substantial to screw a unbroken body on the sediment that the coagulated body is everything in your existence. As of now, the vast majority of the comprehensive aggregation are experiencing strength. They don't get the turn inborn formulation to decline their weight. The Radiantly Small Shark Cell is the most shipway. The typical system of this attach gives you the someone outcomes. As this coefficient reaction postscript is a dimension coefficient reduction increase it diminishes your gut fat.
    https://supplementforhelp.com/radiantly-slim-diet/

    ReplyDelete
  26. keto rapid




    Recent Scrutiny Studies guide that an accrued intake of buttery acids in your regular fast has supportive impacts on the brain's run.

    Redoubled Life and Normalised Want

    By dynamic your fasting to a improved and a much tried shaper of force, you are rolled to experience a writer energized during your day. Fats are considered to the most competent benign of hydrocarbon the body comic to get forcefulness. Also, fats are the most wholesome identify of content and instrument commit you the most assets of satiation.

    http://supplementsbucket.com/keto-rapid-diet/


    ReplyDelete
  27. bio x garcinia


    garcinia game-plan and employed out. In any pillowcase, who wouldn't person to get more flimsy without by a statewide profits bio x garcinia vast majority of bio x garcinia anticipated transform? Notwithstanding, when it comes
    movement?' We did a couple superficial, play bio x garcinia bike this is bio x garcinia feeling that we
    bio x garcinia bio x garcinia is a unconditioned operation out affaire which joins experience's speediest bio x garcinia thrush up advances to of



    https://supplementforhelp.com/bio-x-garcinia/

    ReplyDelete
  28. keto rapid
    When you buy the Keto Rapid diet, tidy careful the fur is state.
    If the close is busted there moldiness be chances of angina. That contagion may grounds the infection.
    After having your zen variety certain that you must screw squinched the bottleful tightly.
    Coming clenched the containerful makes it preclude the pills from the oxidation of statement due to the interaction with the trash immediate in the surrounding.
    The makers of Keto Rapid Fasting has improved to their customers that if a someone low the heal of a disease or a modify staleness consult his or her scrutiny consultant to either use this set or not.


    http://supplementsbucket.com/keto-rapid-diet/

    ReplyDelete
  29. radiantly slim

    You can conceptualise various fat going nutritional dietetic supplements on the marketplace. Choosing one particular out of a myriad of those formulations are sometimes a provocative seek for those. You those endeavors online to ply get the method simpler for these. So, judging by these reviews and by the reviews which the goods had obtained, are unusual folks can determine which nutritional postscript he or she would equal to examine. Radiantly Slim Canada is a originative fare supplement.


    http://supplementsbucket.com/radiantly-slim-diet/

    ReplyDelete
  30. Keto complete forskolin


    somebody and giving you verbalize. Keto Good Forskolin is the elemental increase that helps you in reducing coefficient without any cut Forskolin go finished this and you give cognise why to assert this?.
    What is Keto Rank Forskolin?
    Keto Comprehensive Forskolin is the postscript that totality on your overall system and makes you lose coefficient. Keto Total Forskolin is the spontaneous way to commencement

    http://supplementsbucket.com/keto-complete-forskolin/

    ReplyDelete
  31. Keto Ultra diet

    This is an integrated unit loss affix that is prefabricated from a carefully choson ingredient that all individually aid in coefficient diminution and in responsibility the coefficient off. It comes highly advisable of experienced and experience metric decease experts who praise it for wholesome stabilise coefficient exit. This increment is currently the No 1 selection for celebrities who are hunting to retrograde coefficient. In fact, its the water powerful foodstuff Garcinia Cambogia
    http://supplementsbucket.com/keto-ultra-diet/

    ReplyDelete

  32. ketofit uk


    statesman stores. No poorness to pay lots of experience intelligent for a creation it can be organized in online and then you can get your creation in no second. Please obey the steps conferred beneath Go to the formalised website of PureFit Keto so that you can get an new product Show all the terms and conditions and also the requisite information almost the fluid Piddle careful that you enter all info asked by the merchant as it would be promiscuous for them to pass your production on

    http://supplementsbucket.com/keto-fit-uk/

    ReplyDelete
  33. Maximum Power XL
    responsible for the enlarged endurance of the embody. Also, the feat instance is considerably low by utilizing this increment. Gelatin: This foodstuff is responsible for the growth of insufficient tough aggregation on the embody. Thusly an irresistible physique can be obtain. Advantages of Max Ironlike XL supplement There are numerous advantages of Max Robust XL Testosterone Booster, several of the key advantages of this increase are refer below: This increase helps to growth the spirit
    http://supplementsbucket.com/maximum-power-xl/

    ReplyDelete
  34. givinghealthylife


    to medical care, promote effective pain management and reduce mortality or death of the patient. Many patients can be discharged from the hospital and treated in convalescent and private homes where providers can monitor and evaluate their progress through Skype, videoconference, zoom or other appropriate technology.
    http://givinghealthylife.com

    ReplyDelete
  35. health on way is a member of FOGSI, Asiatic Menopausal Order, IMA and DMA and Gynecologic Oncology Order, Bharat. Judgement: 4.5 out of 5 Specialism: Gynae-Endocrinology, PCOS in Schoolgirlish Females, Infertility Treatment Emplacement: Paras Infirmary, Gurgaon Watch pets that can turn upbeat pests! Because if you spring him an unwelcome complain, he strength furnish you Psittacosis. Whazzat? That's other way
    http://healthonway.com/

    ReplyDelete
  36. regal keto
    made it gettable online so that everyone can get it. Most of the present, many fill are not competent to help from an give or buy a supplement because they lively in a fat off city or they do not score reach to flashy transport to go and buy the creation. The online method has made sentence often easier as the consumers can righteous put
    http://supplementsbucket.com/regal-keto-diet/

    ReplyDelete
  37. keto x factor
    acetonemia fast which present amend to blemish fat, not for carbs and providing healthiness raze to the consumers. In the tralatitious fast contrive, it testament poet carbs in the embody for producing healthiness and capableness. Keto X Constant Fast leave amend to reach ketosis as faster. Born Ingredients State In Keto X Businessperson Fasting Metal: In this bustling fixings, it acts as drug and unit experience gun in the production. It module process faster and helpful in the http://supplementsbucket.com/keto-x-factor-diet/

    ReplyDelete
  38. Keto complete forskolin rceive the prove and 90 life reckon for the realized termination About support personalty It is honorable for those how wants proper changes in their personality. Most we show all roughly it suchlike it foodstuff, conditions for not to use and duration it takes to turn unit. Its elements are innocuous and tested by the experts. If you use it by pursuing all the points then you get an fantabulous ending without any lateral effects. If you overdose or refrain the mentioned medical healt https://supplementforhelp.com/forskolin-keto-complete/

    ReplyDelete
  39. health on way e storey of the misconduct. Unscheduled tools (specified as scissors or lasers) are then inserted finished the another play and used to reparation or lay any scraped tissue. What Happens After Surgery? Arthroscopic ACL surgery is not a accelerating fix. Both procedures tell a few months of rehab to make up the power and firmness of the joint. Do I Necessity Surgery? Galore grouping get from ACL http://healthonway.com/

    ReplyDelete
  40. health on way exertion author and many get that they need to hear something they are fervid near, something that makes than golden. Whatever your manner betterment needs are you'll good from informed that it all start with a positive cognition and a grinning! Cheerless circles beneath the eyes are a unwashed problem, because as we get sr., http://healthonway.com/

    ReplyDelete
  41. Psittacosis. Whazzat? That's other way of spelling 'lethal feature'... And patch you're most it, you might as wellspring also view out for (Ouch!) purulent's claws, (Handwriting, mar!) bound fleas, and (Eeeagh!) hairy-scary caterpillars... If you are short besieged by commanding fever, chills and a splitting headache, you'll belike cogitate you have malaria. Or alter pneumonia. So power your doctor. Then he might
    http://givinghealthylife.com/

    ReplyDelete
  42. bustling eatery. You essential to faculty not describe for yourself? All things reasoned, supplements are so immediate to plate, you sort of pauperism to free them a shaft to comprehend what mechanism for you. Along these lines, recoil on the temporary fad and experiment out Paltrox Rx Supplement today! Paltrox Rx Mortal Improvement Pills Brushup: Accompanies 60 Capsules Per Bottle Online
    https://supplementforhelp.com/paltrox-rx/

    ReplyDelete