Binding problem with TabView DataTemplates

Darren 1 Reputation point

I am trying to create a tabbed view of collection view lists with all VM bindings. That way tabs and their lists (based on a state) can added in data if more states are setup.

Here is a light version of the XAML

        <xct:TabView TabItemsSource="{Binding Tabs}">

                    <StackLayout><Label Text="{Binding TabTitle}" /></StackLayout>

                    Command="{Binding TabChangedCommand}"
                    EventName="SelectionChanged" />

                    <!--  binding context is the TabHeader in Tabs  -->
                    <CollectionView ItemsSource="{Binding Orders}">
                                <StackLayout><Label Text="{Binding CustomerName}" /></StackLayout>



I have a test project on Github if anyone wants to get a better understanding

The problem with data binding is that the CollectionView ItemsSource="{Binding Orders}" is binding to the TabHeader object in the collection used to bind the tabs to data collection TabView TabItemsSource="{Binding Tabs}". Should I move the collection view outside of the tabs and have one collection view for all tabs (sks states) or is there a way to bind the collection view to a data source in the view model for the page.

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,313 questions
{count} votes