Skip to content
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

Closed
thaihuydang opened this issue May 12, 2022 · 15 comments
Closed

[Android]Can't tap with Frame in CollectionView on Android #7121

thaihuydang opened this issue May 12, 2022 · 15 comments
Assignees
Labels
legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/android 🤖 s/no-repro Can no longer be reproduced on latest t/bug Something isn't working

Comments

@thaihuydang
Copy link

Description

When I add Frame control in data template in collection view, I can't tap on collection view.

Steps to Reproduce

  1. Create Maui App
  2. Add collection view
  3. add frame to colleciton view

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

@thaihuydang thaihuydang added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels May 12, 2022
@thaihuydang thaihuydang changed the title Can't tap with Frame in CollectionView on Android [Android]Can't tap with Frame in CollectionView on Android May 12, 2022
@VincentBu VincentBu added the s/verified Verified / Reproducible Issue ready for Engineering Triage label May 13, 2022
@VincentBu
Copy link

not repro with vs main build(32512.449.main). Here is an example. @thaihuydang , would you like to verify it with your vs?
MauiApp7121.zip

@RedChops
Copy link

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

@RedChops
Copy link

MauiApp7121.zip

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

@jfversluis jfversluis added legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels May 13, 2022
@thaihuydang
Copy link
Author

thaihuydang commented May 13, 2022

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

Yes, exactly the same with my vs

@IeuanWalker
Copy link

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>

@VincentBu
Copy link

Yes, Item selection event doesn't triggered. SelectionChanged method isn't called.

@xrail91
Copy link

xrail91 commented May 17, 2022

Only the area with the Frame is not triggering the Event. My Frame has a little margin on it and if you click outside the frame the event / command fires.

Hope this is helpfull.

collectionView_Frame

@ederbond
Copy link
Contributor

ederbond commented May 25, 2022

Workaround: Replace the frame with a <Border>.
The <Border> element it's works fine.

@Redth Redth added the partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with label Nov 28, 2022
@Redth Redth added this to the Backlog milestone Nov 28, 2022
@ghost
Copy link

ghost commented Nov 28, 2022

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.

@Redth
Copy link
Member

Redth commented Nov 28, 2022

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.

@yunusefendi52
Copy link
Contributor

@Redth Border is good for new app, what about xf porting to maui? changing Frame to Border is a lot of work

@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Dec 17, 2022
@samhouts samhouts modified the milestones: Backlog, .NET 8 Planning Jan 26, 2023
@jsuarezruiz jsuarezruiz self-assigned this Mar 28, 2023
@samhouts samhouts removed the s/verified Verified / Reproducible Issue ready for Engineering Triage label Apr 5, 2023
@samhouts samhouts removed this from the .NET 8 Planning milestone May 25, 2023
@samhouts samhouts added this to the .NET 8 milestone May 25, 2023
@suchithm
Copy link

suchithm commented Jun 19, 2023

Any update? Almost one year (Jun/2023) same issue, seeing ToDo tag?
UPDATE:
Looks like border works fine,
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/border

@jfversluis
Copy link
Member

I think this might be fixed by #14846 @mattleibow

@hartez
Copy link
Contributor

hartez commented Jul 10, 2023

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.

@hartez hartez closed this as completed Jul 10, 2023
@samhouts samhouts added the s/no-repro Can no longer be reproduced on latest label Jul 13, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/android 🤖 s/no-repro Can no longer be reproduced on latest t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.