I have the following markup in my Xaml:
<ScrollView Orientation="Vertical">
<StackLayout VerticalOptions="StartAndExpand" HorizontalOptions="CenterAndExpand">
<Label>Johnny's Diary</Label>
</StackLayout>
<ListView ItemsSource="{Binding GroupedItems}" IsGroupingEnabled="True" GroupDisplayBinding="{ Binding Day }" IsEnabled="False" InputTransparent="True">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Title}" Detail="{Binding Text}"></TextCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollView>
However, when I add in an inner ScrollView:
<ScrollView Orientation="Vertical">
<StackLayout VerticalOptions="StartAndExpand" HorizontalOptions="CenterAndExpand">
<Label>Johnny's Diary</Label>
</StackLayout>
<ListView ItemsSource="{Binding GroupedItems}" IsGroupingEnabled="True" GroupDisplayBinding="{ Binding Day }" IsEnabled="False" InputTransparent="True">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Title}" Detail="{Binding Text}"></TextCell>
<ScrollView Orientation="Horizontal">
</ScrollView>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollView>
I get the following exception:
An item with the same key has already been added
It seems to be happening when InitializeComponent is called in the Xaml code behind.
Is this a drawback of Xamarin Forms? Can't I nest controls of the same type, this seems a little silly? How can I get around this issue?
Thanks
Mark