[Bug] TabView does not respect the BindingContext the user manually assigns to TabViewItems
Stackoverflow question
Prism View is being assigned parent page ViewModel inside XCT tabview
Description
TabView overwrites the BindingContext value of TabViewItems content views.
https://github.com/xamarin/XamarinCommunityToolkit/blob/3abf5fa7eeaa29e76e9b1bfeb17575b75bccc799/src/CommunityToolkit/Xamarin.CommunityToolkit/Views/TabView/TabView.shared.cs#L430-L439
Steps to Reproduce
- Create a new project with TabView and add some TabViewItems
- Set a different BindingContext value to TabViewItem's Content views
- Run the app and check if BindingContext of TabViewItems is the same the user assigned to them
Expected Behavior
TabView should respect the BindingContext the user assigns to TabViewItems
Actual Behavior
TabView overwrites the BindingContext value of TabViewItems.
Basic Information
- Version with issue 1.0.3:
Reproduction Link
Workaround
Wrap the content of the tab in a ContentView:
<xct:TabViewItem Text="Home">
<xct:TabViewItem.Content>
<ContentView>
<local:HomeView BindingContext="{Binding HomeViewModel}" />
</ContentView>
</xct:TabViewItem.Content>
</xct:TabViewItem>
I just updated the issue to include the reproduction project.
Same issue is here for me.
The same here. The ContentView workaround is working for now.
Same issue still persists for me.
The same here. The ContentView workaround is working for now.
Could you please tell me what the ContentView workaround is? Thank you.
Same issue still persists for me.
The same here. The ContentView workaround is working for now.
Could you please tell me what the ContentView workaround is? Thank you.
Nevermind, recent update has resolved this issue.
Same issue still persists for me.
The same here. The ContentView workaround is working for now.
Could you please tell me what the ContentView workaround is? Thank you.
Nevermind, recent update has resolved this issue.
Already released? I´m using the last 1.3.0 version and it is still failing, anyway the workaround is working fine.
still happening on 1.3.2. The workaround seems to fix it.