Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Nested ListViews with MVVM / Prism

$
0
0

Hey there,

does somebody know how to use a ListView with an ObservableCollection as ItemsSource and a ListView.ItemTemplate with another ListView inside? How can I bind data to the inner ObservableCollection Tariffs nested in TariffDays?

            <ListView ItemsSource="{Binding TariffDays}"
                      SelectedItem="{Binding SelectedTariffDay, Mode=TwoWay}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Label Text="{Binding Name}" />

                            <ListView ItemsSource="{Binding Tariffs}">
                                <ListView.ItemTemplate>
                                    <DataTemplate>
                                        <ViewCell>
                                            <Label Text="{Binding StartTime}" />
                                        </ViewCell>
                                    </DataTemplate>
                                </ListView.ItemTemplate>
                            </ListView>

                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

It's not working at all and I read that this is not working in Xamarin, but how can I achieve this anyway without breaking the rules?

Cheers


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>