HyperlinkButton in C# XAMARIN.FORMS

后端 未结 7 1479
南方客
南方客 2021-02-19 02:36

I want to create Label with click possibility like in WIN phone xaml


Is there a possibili

7条回答
  •  攒了一身酷
    2021-02-19 03:10

    I would suggest using GestureRecognizers and adding a Tap Gesture to a label. Ref: here

    var label = new Label()
    {
      Text="My Hyperlink"
    };
    var tapGestureRecognizer = new TapGestureRecognizer();
    tapGestureRecognizer.Tapped += (s, e) => {
        // handle the tap
    };
    label.GestureRecognizers.Add(tapGestureRecognizer);
    

    GestureRecognizer is a public property on the View class which Label inherits from. See here

提交回复
热议问题