Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

TapGestureRecognizer doesn't work for my Hyperlink in Xamarin.Mac #4775

Closed
ChristianKleineidam opened this issue Dec 17, 2018 · 3 comments · Fixed by #4928
Closed

TapGestureRecognizer doesn't work for my Hyperlink in Xamarin.Mac #4775

ChristianKleineidam opened this issue Dec 17, 2018 · 3 comments · Fixed by #4928
Assignees

Comments

@ChristianKleineidam
Copy link

Description

Steps to Reproduce

I create a hyperlink through the code. You need to have a ViewModel with the possibility to bind FileName and FilePickButton:

                            <Label.FormattedText>
                                <FormattedString>
                                    <Span Text="{Binding FileName,Mode=OneWay}"
                                    TextColor="#007AFF"
                                    FontSize="Medium"
                                    TextDecorations="Underline">
                                        <Span.GestureRecognizers>
                                            <TapGestureRecognizer Command="{Binding FilePickButton}" />
                                        </Span.GestureRecognizers>
                                    </Span>
                                </FormattedString>
                            </Label.FormattedText>

Expected Behavior

When I click on den hyperlink the function FilePickButton will be started the same way as it gets started in UWP/Android/iOS

Actual Behavior

When I click on the hyperlink nothing happens.

Basic Information

  • Version with issue: Xamarin Forms 4.0.0.8055-pre1
  • Affected Devices: MacBook Pro 2018

It might be a similar issue as #2750 but I submitted a separate issue as I have the problem without creating a CustomView.

@AndreiMisiukevich
Copy link
Contributor

AndreiMisiukevich commented Jan 9, 2019

@ChristianKleineidam hi
Seems it's by design.. but it isn't convenient.. @rmarinho @PureWeen what do you think?
Use ClickGestureRecognizer for Mac instead (Check Device.RuntimePlatform)

AndreiMisiukevich added a commit to AndreiMisiukevich/Xamarin.Forms that referenced this issue Jan 9, 2019
Added TapGesture handling for Spans on Mac OS
@ChristianKleineidam
Copy link
Author

If I simply exchange TapGestureRecognizer to ClickGestureRecognizer in my code, it doesn't work in UWP.
Given the intention of Xamarin.Forms it seems bad that I have to use a different function depending on the platform.

@AndreiMisiukevich
Copy link
Contributor

@ChristianKleineidam yes :) I wanted to provide you any workaround.
Also made PR for solving this issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants