Xamarin Forms UI not properly updated when binding source value changed

I have an issue with binding in xamarin forms when i am using tableview with image cells. I set the binding with var result = new ImageCell() and then result.SetBinding(ImageCell.DetailProperty,"ItemImage");
than i code after change of ItemImage i call calling OnPropertyChanged("ItemImage"); but the image on screen remains same as before change. but when i scroll the page so i dont see it and then scroll it back it refreshes with new one so in fact the issue is that image is not refreshed while is apearing on screen. Same thing happend also with textproperty. This problem also ocured when i was using listview. Is there some possibility to call whole page refresh after i change binded property in viewmodel or some other way to fix it?


  • PaulDistonPaulDiston USUniversity ✭✭✭✭

    Have you tried setting the Binding Mode to TwoWay?

  • IvanUhrinIvanUhrin USMember

    I think they are TwoWay by default but anyway i get the refresh of the value but only after its ui element is not showed (scrolled of screen) and then showed again (scrolled back to it), so it is just not refreshing currently showed and by eye visible ui controls

  • TotemikaTotemika ESMember ✭✭

    @binkman71 Your link doesn't work :(

  • binkman71binkman71 USMember ✭✭

    Dangit...it's just a post I put up about a page on iOS not updating itself via the binding unless I clicked the cells in the list....

  • IvanUhrinIvanUhrin USMember

    Fixed by 1.2.2. pre release version so it is working now.

  • GuidoKerstenGuidoKersten NLUniversity ✭✭

    For what platform(s) did it work for you? Because I'm facing the same problem now. It does work on iOS but doesn't on Android..?

  • RogerSchmidlinRogerSchmidlin CHUniversity ✭✭✭

    I have the same problem on Android ... Have you guys found a solution yet? My picture is not showing properly until I tap on my screen.

  • AlexBrownAlexBrown USMember ✭✭

    I have been finding that relying on the bindings is very frustrating because they are fussy. I have to sometimes add small delays or hacks to get them to work reliably. This week i've been struggling because I have a number of them that are just not updating the ui and I don't know why.

  • VH5150VH5150 GBMember ✭✭

    Same issue here, binding to an ImageCell within a TableView, the ImageCell updates on iOS but only intermittently on Android.

    Does anyone have any workarounds to share?

  • It's a total hack, but I finally managed to get this working consistently on Android. What I had to do is create an OnRefreshed event in my ViewModel, like so:

            public delegate Task OnRefreshHandler();
            public OnRefreshHandler OnRefresh;

    That gets called whenever the model is updated (OnAppearing or in response to a message).

    And then in my BaseView (the XLabs.Forms wrapper for ContentPage), I subscribe...

            public MainPage(MainPageViewModel model)
                this.BindingContext = model;
                model.OnRefresh += ModelRefreshed;

    with a method that adds a slight delay and re-binds the image source (repeat of the binding that happens in the constructor).

            private async Task ModelRefreshed()
                await Task.Delay(200);
                logoImage.SetBinding(Image.SourceProperty, "LogoSource");

    Neither the delay nor the re-binding are enough--I had to do both, in that order. As you can see I first tried ForceLayout and InvalidateMeasure, neither of which helped.

  • ArccexArccex DEMember

    I had the same problem and a INotifyPropertyChanged worked for me

Sign In or Register to comment.