A Microsoft framework for building cross-platform mobile apps using .NET and C# with native performance and user interfaces.
Hello,
Welcome to our Microsoft Q&A platform!
I test it through the code snippet you provided, and only add the content of SwipeView and RightItems, when click CollectionView ,it is highlighted. It works in both iOS and Android, I can't reproduce this issue.
<StackLayout>
<CollectionView
SelectionMode="Single"
ItemsSource="{Binding SourceList}">
<CollectionView.ItemTemplate >
<DataTemplate>
<SwipeView >
<SwipeView.RightItems>
<SwipeItems><!--add SwipeItem-->
<SwipeItem Text="delete" BackgroundColor="Blue" Invoked="SwipeItem_Invoked">
</SwipeItem>
</SwipeItems>
</SwipeView.RightItems>
<StackLayout><!--add this content-->
<Label Text="{Binding .}" HeightRequest="80"></Label>
</StackLayout>
</SwipeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
Then I try to set SwipeView background color to white, and add VisualStateManager.VisualStateGroups , it also works, you could have a try.
<CollectionView
SelectionMode="Single"
ItemsSource="{Binding SourceList}">
<CollectionView.ItemTemplate >
<DataTemplate>
<SwipeView BackgroundColor="White">
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="delete" BackgroundColor="Blue" Invoked="SwipeItem_Invoked">
</SwipeItem>
</SwipeItems>
</SwipeView.RightItems>
<StackLayout>
<Label Text="{Binding .}" HeightRequest="80"></Label>
</StackLayout>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="CommonStates">
<VisualState Name="Normal" />
<VisualState Name="Selected">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="Yellow" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</SwipeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
I'm afraid you could share more operation information, running environment and code snippets or share me a demo to test.
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.