xabre / xamarin-forms-tab-badge

Xamarin Forms bindable Tab badges for iOS, Android, UWP, MacOS and WPF
MIT License
307 stars 75 forks source link

Badge does not bind correctly if starting off with a <null> value #78

Open morbidcamel101 opened 4 years ago

morbidcamel101 commented 4 years ago

In my scenario I have a few tabs that I want to slap badges on, but only after I have fetched the data using an asynchronous dependency service. I fetch the data and then set the bindatbe property to something like this _viewModel.HomeBadgeText = items.Count.ToString(); with HomeBadgeText being my binding in the XAML file. If I do this with an initial <null> value the badge never updates, HOWEVER, if I set the initial value of HomeBadgeText to '0' and then update it after the data has been fetched the binding works as expected.

arhiggi3 commented 4 years ago

I have this problem as well but only on Android. Someone on my team claims that it works on earlier android versions but it definitely isn't working for me on a 9 device.

EDIT: My workaround is to default the text to string.Empty instead of null. string.Empty will hide the badge.