Xamarin.forms: Label's Text value becomes null when used Triggers after updating its value through BindingContext

Created on 19 Sep 2018  路  11Comments  路  Source: xamarin/Xamarin.Forms

Hi Team,

Description

We have made a custom control to reuse the items in the View by updating only their BindingContext i.e., Similar to XForms ListView CachingStrategy-RecycleElement. When used Triggers for Label element inside the ItemTemplate of the custom control, we have noticed some odd behavior.
We have used 2 DataTriggers for a single Label element and applied Setter for Label's Text, TextColor and BackgroundColor properties. This DataTrigger will be chosen based on the Model bool value[In our case we have considered 'Favorite' value]. For the first DataTrigger, we have directly used string value for Label's Text and for second DataTrigger, we have bound the string property from model class.
Initially when the View is loaded, everything works fine and the items are layout based on the trigger values. But while scrolling, i.e., when the BindingContext gets updated for the item to be appeared in the view, the static Text value becomes 'null'. This is the issue, we are facing currently. We have checked whether the triggers values have been reset or wrong BindingContext has been set for the item. But still everything works fine and the trigger value for this condition is still maintained. The same template works fine when using XForms ListView with RecycleElement.
Another strange thing is that the Color attributes which we have used[FontColor and BackgroundColor] have been updated properly while scrolling! To add up some weirdness, alternating the position of both the triggers works fine while scrolling!! This issue is notable in UWP and iOS platforms. This template doesn't work in Android platform[Even when replaced custom control with XForms ListView] which is another issue.

Steps to Reproduce

  1. Run the attached sample.
  2. In UWP, Scroll up and down the list faster. In Android, the View is empty, still the list is scroll-able[same behavior with XForms ListView]. In iOS, just scroll down the list.

Expected Behavior

While scrolling Label elements should render properly based on the trigger value specified. In android platform, the label elements should render in the View when applied triggers.

Actual Behavior

Notice that the text 'This disappears on scrolling' disappears in UWP and iOS platform. In android, label is entirely invisible.

Reproduction Link

Please find the issue replicating sample with the video cast to showcase the issue in the below link.

TriggerIssue.zip

4 help wanted partner bug up-for-grabs

All 11 comments

Possibly duplicate of #1412

Hi,

Thanks for the reference.
Still i couldn't recognize why the text value becomes null while updating BindingContext!?
And i think the color value still remains intact! Maybe but not for sure.

Thanks.

@samhouts , can you update the status on this?

@DineshBabuYadav We're working to get this prioritized. Thank you!

@samhouts we are still looking for fix.

This is on the backlog. Given our current set of priorities, we expect to begin working on this in mid September. Thank you for your patience!

@samhouts : Thanks for your update, we will wait for your fix. Please update once completed

@samhouts : Any update on this

@mageshyadavm This was delayed due to other high priority issues moving ahead of it in the backlog. I don't currently have an estimate of when we may begin work on this item. Thank you for your patience!

@samhouts I have updated sample to latest Syncfusion and xamarin nuget and still this issue coming.
GettingStarted.zip

@samhouts , can you please update ETA for this fix?

Was this page helpful?
0 / 5 - 0 ratings