-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android]Can't tap with Frame in CollectionView on Android #7121
Comments
not repro with vs main build(32512.449.main). Here is an example. @thaihuydang , would you like to verify it with your vs? |
FWIW, it doesn't work for me either. I switched to using Border in my app instead of Frame so my testing is limited. The SelectedItem command is definitely not called, I don't think the tapped event is fired either. Some events work though, if I set CollectionView.CanReorderItems = True, I can reorder the frames, but still not tap them and get the event. The sample app from @VincentBu uses a gesture recognizer within an element inside the frame inside the CollectionView - those gesture recognizers do work for me, what doesn't work is the selection events on the CollectionView itself when using Frame |
With this updated sample, if you click any of the items, it should log a message in the console. Instead, nothing gets logged, suggesting that the SelectionChanged event never gets fired if a Frame is used in the ItemTemplate |
Yes, exactly the same with my vs |
Ye same issue here - <CollectionView FlowDirection="RightToLeft"
ItemSizingStrategy="MeasureFirstItem"
ItemsLayout="HorizontalList"
ItemsSource="{Binding Dates}"
SelectedItem="{Binding SelectedDiary}"
SelectionMode="Single">
<CollectionView.ItemTemplate>
<DataTemplate>
<ContentView Padding="10" x:DataType="viewModel:DiaryTestModel">
<Frame Padding="0"
BackgroundColor="#E5F7FF"
CornerRadius="20"
HasShadow="False"
IsEnabled="false">
<VerticalStackLayout Padding="10">
<Label HorizontalTextAlignment="Center"
Text="{Binding DayOfTheWeekLetter}"
TextColor="#00A2EE" />
<Label HorizontalTextAlignment="Center"
Text="{Binding Date, StringFormat='{0:dd}'}"
TextColor="Black" />
</VerticalStackLayout>
</Frame>
</ContentView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView> |
Yes, Item selection event doesn't triggered. |
Workaround: Replace the frame with a |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
As mentioned, there's a workaround which is to use a Border. We generally recommend this as opposed to the frame anyway. You can achieve the same rounded corners and/or shadow effect with a Border. |
@Redth Border is good for new app, what about xf porting to maui? changing Frame to Border is a lot of work |
This method intercepts the touch: Then is blocked here: This method returns true. In Xamarin.Forms, this line is extra: That might be the issue? |
Any update? Almost one year (Jun/2023) same issue, seeing ToDo tag? |
I think this might be fixed by #14846 @mattleibow |
Just tried the repro project on 17.6.4, and the OnTapped method is called when I tap an item in the CollectionView. Not sure which specific PR fixed it, but as far as I can tell this works fine on 7.0. |
Description
When I add Frame control in data template in collection view, I can't tap on collection view.
Steps to Reproduce
Version with bug
Release Candidate 3 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: