A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
CollectionView selection does not working depending on ItemTemplate
I have a CollectionView which has the following ItemTemplate: (BTW I copy the code and now have no idea what will be shown as I cannot go to the end of this post and put text after the ItemTemplate so another kudo to this forum for its new terrible site).
The definition of the CollectionView is: (And if this post seems screwy it is the site that is causing this.)
As you can see the SelectionMode is Single and I have a SelectedItem and a SelectionChanged event. When I use the ItemTemplate as shown I do not get either the SelectedItem or the event. If I get rid of the Frame I get them but the UI is no good. This has to be a bug since it works sometimes depending on the ItemTemplate.
<CollectionView ItemsSource="{Binding theDates}" Grid.Row="2"
SelectionMode="Single"
SelectedItem="{Binding selectedItem}"
SelectionChanged="CollectionView_SelectionChanged">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" CornerRadius="1" BackgroundColor="LightYellow">
<VerticalStackLayout>
<Label Text="{Binding theDay.Day}" FontSize="10"></Label>
<Label Text="{Binding appointMents}" FontSize="10"></Label>
</VerticalStackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>