Using DataTemplate breaks ObservableCollection binding #15147
Labels
area-layout
StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter
layout-flex
FlexLayout issues
platform/android 🤖
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
Description
In the application I have AppContentView, it's a very small control, that inherits from ContentView and adds Title bindable property - that's it. I'm using it to show different content wrapped in the same visual style.
To switch between these views I have labels rendered by BindableLayout and collection binding and GestureRecognizer (in a real application I have my custom control, but let's keep it simple as it is in the reproducible sample).
In the app, I have only two AppContentViews, one of them is an empty view and the first one contains an ObservableCollection of strings and a command to add a string to the collection.
Now here comes the important part! If I click on the button to add a string BEFORE switching the view, the string is added to the ObservableCollection as expected, but, once I switch a view and go back, the ObservableCollection binding is broken! BUT, only for ObservableCollection, the rest of the bindings work as expected!
However, if I use buttons instead of GestureRecognizer it works! (Which I obviously can't use, because I can't style buttons.)
I've tested it also in Windows and it works as expected (even though there is a significant delay in displaying new items), only the Android is completely broken. The iOS version I can't currently verify.
Steps to Reproduce
Link to public reproduction project repository
https://github.com/Sebosek/BrokenDataTemplate
Version with bug
7.0.81
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 12 (API 31)
Did you find any workaround?
No.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: