dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

BugDragGestureRecognizer - codebehind - not working on iOS and Android - works on windows. #22545

Open RobDaytona opened 5 months ago

RobDaytona commented 5 months ago

Description

I create a new default maui app using the latest VS2022, I give the hello world label and ID and add a BugDragGestureRecognizer to it. The label can be dragged in Windows, but not iOS or Android - I am using physical devices with latest Operating systems.

Steps to Reproduce

Create File -> New Maui App Open mainpage.xaml and give the Hello world an ID: of lbhelloWorld <Label x:Name="lbhelloWorld" Text="Hello, World!" Style="{StaticResource Headline}" SemanticProperties.HeadingLevel="Level1" />

 Update the MainPage.cs constructor method like so:

    public MainPage()
    {
        InitializeComponent();

        var dragGestureRecognizer = new DragGestureRecognizer
        {
            CanDrag = true
        };

        lbhelloWorld.GestureRecognizers.Add(dragGestureRecognizer);

    }

Run the project, you should be able to drag the Hello World label around, but cannot in iOS or Android

dotnet workload list

Installed Workload Id Manifest Version Installation Source

android 34.0.52/8.0.100 VS 17.9.34723.18 maui-windows 8.0.7/8.0.100 VS 17.9.34723.18 maccatalyst 17.2.8004/8.0.100 VS 17.9.34723.18 ios 17.2.8004/8.0.100 VS 17.9.34723.18

Use dotnet workload search to find additional workloads to install.

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

iOS 17.4.1 , Android Version 14

Did you find any workaround?

I have not found a work around please help.

Relevant log output

No response

github-actions[bot] commented 5 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

ninachen03 commented 5 months ago

Verified this issue with Visual Studio 17.10 Preview 7 (8.0.40 & 8.0.3 ). Can repro it. code as below image

image

PureWeen commented 5 months ago

@ninachen03 can you attach your repro please?

ninachen03 commented 5 months ago

@PureWeen here is the sample project. https://microsoft-my.sharepoint.com/:u:/p/v-dongmc/Eeda192t-rRJsJjFfCZeM5IBCZ_18GVEiqui_g0DQPlgig?e=CmI7oI

RobDaytona commented 5 months ago

just checking in..

kubaflo commented 5 months ago

It works for me with the following code

    <ScrollView>
        <VerticalStackLayout>
            <Label Text="label" x:Name="label"/>
        </VerticalStackLayout>
    </ScrollView>
        public MainPage()
        {
            InitializeComponent(); 

            var dragGestureRecognizer = new DragGestureRecognizer
            {
                CanDrag = true
            };

                   label.GestureRecognizers.Add(dragGestureRecognizer);
        }

https://github.com/dotnet/maui/assets/42434498/cb045b92-e3e2-4da2-a527-bd2e1f01b800